* [PATCH] sg: fix leak when dio setup fails
@ 2006-03-28 19:48 Douglas Gilbert
2006-03-30 19:15 ` Bryan Holty
0 siblings, 1 reply; 2+ messages in thread
From: Douglas Gilbert @ 2006-03-28 19:48 UTC (permalink / raw)
To: linux-scsi; +Cc: lgeek
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
Further to this thread started by Bryan Holty:
http://marc.theaimsgroup.com/?l=linux-scsi&m=114306885116728&w=2
Here is the reworked patch again. This time it has been
tested with a program provided by Bryan. The patch is
against lk 2.6.16 .
Changelog:
- when the sg driver is unable to setup direct IO,
free that scatter gather list prior to falling
back to indirect IO
Signed-off-by: Douglas Gilbert <dougg@torque.net>
Doug Gilbert
[-- Attachment #2: sg2616dio_lk.diff --]
[-- Type: text/x-patch, Size: 471 bytes --]
--- linux/drivers/scsi/sg.c 2006-03-20 10:08:49.000000000 -0500
+++ linux/drivers/scsi/sg.c2616dio_lk 2006-03-22 18:26:23.000000000 -0500
@@ -1834,8 +1834,10 @@
res = st_map_user_pages(schp->buffer, mx_sc_elems,
(unsigned long)hp->dxferp, dxfer_len,
(SG_DXFER_TO_DEV == hp->dxfer_direction) ? 1 : 0);
- if (res <= 0)
+ if (res <= 0) {
+ sg_remove_scat(schp);
return 1;
+ }
schp->k_use_sg = res;
schp->dio_in_use = 1;
hp->info |= SG_INFO_DIRECT_IO;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sg: fix leak when dio setup fails
2006-03-28 19:48 [PATCH] sg: fix leak when dio setup fails Douglas Gilbert
@ 2006-03-30 19:15 ` Bryan Holty
0 siblings, 0 replies; 2+ messages in thread
From: Bryan Holty @ 2006-03-30 19:15 UTC (permalink / raw)
To: dougg; +Cc: linux-scsi, James Bottomley
On Tuesday 28 March 2006 13:48, Douglas Gilbert wrote:
> Further to this thread started by Bryan Holty:
> http://marc.theaimsgroup.com/?l=linux-scsi&m=114306885116728&w=2
>
> Here is the reworked patch again. This time it has been
> tested with a program provided by Bryan. The patch is
> against lk 2.6.16 .
>
> Changelog:
> - when the sg driver is unable to setup direct IO,
> free that scatter gather list prior to falling
> back to indirect IO
>
> Signed-off-by: Douglas Gilbert <dougg@torque.net>
>
> Doug Gilbert
Thanks Doug, this fixes the fixes the sg memory leak and the eventual kernel
out of memory killer.
Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: Bryan Holty <lgeek@frontiernet.net>
--- linux/drivers/scsi/sg.c 2006-03-20 10:08:49.000000000 -0500
+++ linux/drivers/scsi/sg.c2616dio_lk 2006-03-22 18:26:23.000000000 -0500
@@ -1834,8 +1834,10 @@
res = st_map_user_pages(schp->buffer, mx_sc_elems,
(unsigned long)hp->dxferp, dxfer_len,
(SG_DXFER_TO_DEV == hp->dxfer_direction) ? 1 : 0);
- if (res <= 0)
+ if (res <= 0) {
+ sg_remove_scat(schp);
return 1;
+ }
schp->k_use_sg = res;
schp->dio_in_use = 1;
hp->info |= SG_INFO_DIRECT_IO;
--
Bryan Holty
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-30 20:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-28 19:48 [PATCH] sg: fix leak when dio setup fails Douglas Gilbert
2006-03-30 19:15 ` Bryan Holty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).