All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix sg leak when scsi_execute_async fails
@ 2006-03-22 22:04 Mike Christie
  2006-03-22 23:10 ` Douglas Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Christie @ 2006-03-22 22:04 UTC (permalink / raw)
  To: dougg, linux-scsi

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.

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

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>



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;



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix sg leak when scsi_execute_async fails
  2006-03-22 22:04 [PATCH] fix sg leak when scsi_execute_async fails Mike Christie
@ 2006-03-22 23:10 ` Douglas Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Douglas Gilbert @ 2006-03-22 23:10 UTC (permalink / raw)
  To: Mike Christie; +Cc: linux-scsi

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@cs.wisc.edu>
Signed-off-by: Douglas Gilbert <dougg@torque.net>

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;
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-22 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-22 22:04 [PATCH] fix sg leak when scsi_execute_async fails Mike Christie
2006-03-22 23:10 ` Douglas Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.