3.18-stable review patch. If anyone has any objections, please let me know.
------------------ From: Tony Battersby <[email protected]> commit c170e5a8d222537e98aa8d4fddb667ff7a2ee114 upstream. Fix a minor memory leak when there is an error opening a /dev/sg device. Fixes: cc833acbee9d ("sg: O_EXCL and other lock handling") Cc: <[email protected]> Reviewed-by: Ewan D. Milne <[email protected]> Signed-off-by: Tony Battersby <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- drivers/scsi/sg.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -2242,6 +2242,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);

