Message ID | 3c90c434-0ce4-c8df-1359-1453be766043@cybernetics.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Thu, 2018-07-12 at 14:46 -0400, Tony Battersby wrote: > Fix a minor memory leak when there is an error opening a /dev/sg device. > > Signed-off-by: Tony Battersby <tonyb@cybernetics.com> > --- > diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c > index cd2fdac..2962a38 100644 > --- a/drivers/scsi/sg.c > +++ b/drivers/scsi/sg.c > @@ -2185,6 +2185,7 @@ sg_add_sfp(Sg_device * sdp) > write_lock_irqsave(&sdp->sfd_lock, iflags); > if (atomic_read(&sdp->detaching)) { > write_unlock_irqrestore(&sdp->sfd_lock, iflags); > + kfree(sfp); > return ERR_PTR(-ENODEV); > } > list_add_tail(&sfp->sfd_siblings, &sdp->sfds); > Reviewed-by: Ewan D. Milne <emilne@redhat.com>
On Thu, 2018-07-12 at 14:46 -0400, Tony Battersby wrote:
> Fix a minor memory leak when there is an error opening a /dev/sg device.
Please Cc: stable for patches like this and please also add a Fixes: tag.
Thanks,
Bart.
On 2018-07-12 02:46 PM, Tony Battersby wrote: > Fix a minor memory leak when there is an error opening a /dev/sg device. > > Signed-off-by: Tony Battersby <tonyb@cybernetics.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Thanks. > --- > diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c > index cd2fdac..2962a38 100644 > --- a/drivers/scsi/sg.c > +++ b/drivers/scsi/sg.c > @@ -2185,6 +2185,7 @@ sg_add_sfp(Sg_device * sdp) > write_lock_irqsave(&sdp->sfd_lock, iflags); > if (atomic_read(&sdp->detaching)) { > write_unlock_irqrestore(&sdp->sfd_lock, iflags); > + kfree(sfp); > return ERR_PTR(-ENODEV); > } > list_add_tail(&sfp->sfd_siblings, &sdp->sfds); > >
Tony, > Fix a minor memory leak when there is an error opening a /dev/sg > device. Applied to 4.18/scsi-fixes, thanks!
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index cd2fdac..2962a38 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -2185,6 +2185,7 @@ sg_add_sfp(Sg_device * sdp) write_lock_irqsave(&sdp->sfd_lock, iflags); if (atomic_read(&sdp->detaching)) { write_unlock_irqrestore(&sdp->sfd_lock, iflags); + kfree(sfp); return ERR_PTR(-ENODEV); } list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
Fix a minor memory leak when there is an error opening a /dev/sg device. Signed-off-by: Tony Battersby <tonyb@cybernetics.com> ---