Re: [PATCH] fix sg leak when scsi_execute_async fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike Christie wrote:
> Doug found a bug where if scsi_execute_async fails, we are leaking
> sg resources. scsi_do_req never failed so we did not have to handle
> that case before.

When a SCSI command request falls foul of the extra
requirements in lk 2.6.16 (e.g. max_sectors), the
resulting ENOMEM leaves unfinished business in
the sg driver's own data structures. This can be
seen with 'cat /proc/scs/sg/debug' .

> Patch was made against scsi-misc. Not sure if this should
> also go to stable?

I think it should. It fixes a bug on an error
path by adding the same cleanup call as found
on other paths.

> Signed-off-by: Mike Christie <michaelc@xxxxxxxxxxx>
Signed-off-by: Douglas Gilbert <dougg@xxxxxxxxxx>

Doug Gilbert

> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index a8b05ce..71994ea 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -748,6 +748,7 @@ sg_common_write(Sg_fd * sfp, Sg_request 
>  		/*
>  		 * most likely out of mem, but could also be a bad map
>  		 */
> +		sg_finish_rem_req(srp);
>  		return -ENOMEM;
>  	} else
>  		return 0;
> 
> 

-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux