Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1274007 > unrolled thread

Re: [PATCH] Fix a memory leak in scsi_host_dev_release()

Started byChristoph Hellwig <hch@infradead.org>
First post2015-11-20 13:00 +0100
Last post2015-11-22 16:10 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] Fix a memory leak in scsi_host_dev_release() Christoph Hellwig <hch@infradead.org> - 2015-11-20 13:00 +0100
    Re: [PATCH] Fix a memory leak in scsi_host_dev_release() Christoph Hellwig <hch@infradead.org> - 2015-11-22 16:10 +0100

#1274007 — Re: [PATCH] Fix a memory leak in scsi_host_dev_release()

FromChristoph Hellwig <hch@infradead.org>
Date2015-11-20 13:00 +0100
SubjectRe: [PATCH] Fix a memory leak in scsi_host_dev_release()
Message-ID<qwSw9-6Id-15@gated-at.bofh.it>
Hi Bart,

the memory leak looks real, and your fix looks corret, but I still
don't like it.

I think it's reasonable for SCSI to assume that the final put_device
fully frees the struct device including the name pointer that is
assigned entirely behind the back of the caller.

So I think the fix for this probably should be in the driver core.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1274889

FromChristoph Hellwig <hch@infradead.org>
Date2015-11-22 16:10 +0100
Message-ID<qxEr7-5wP-7@gated-at.bofh.it>
In reply to#1274007
On Fri, Nov 20, 2015 at 09:49:42AM -0800, Bart Van Assche wrote:
> On 11/20/2015 03:52 AM, Christoph Hellwig wrote:
> >the memory leak looks real, and your fix looks corret, but I still
> >don't like it.
> >
> >I think it's reasonable for SCSI to assume that the final put_device
> >fully frees the struct device including the name pointer that is
> >assigned entirely behind the back of the caller.
> >
> >So I think the fix for this probably should be in the driver core.
> 
> Hello Christoph,
> 
> Thanks for the feedback. However, I'm not sure this can be fixed by
> modifying the driver core. If scsi_host_remove() is not called the SCSI core
> doesn't call put_device(&shost->shost_dev). I will post a second version of
> this patch that ensures that the SCSI core always calls
> put_device(&shost->shost_dev).


Oh, I see.  The release method is called on shost_gendev, but the
name that needs to be freed is in shost_dev.  I take my comment on the
core back.

Let's get this patch in for now and see if we can do something about the
creative driver model (ab-)use for struct Scsi_Host in the long run.

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web