From: Bryan Holty <lgeek@frontiernet.net>
To: dougg@torque.net
Cc: linux-scsi@vger.kernel.org,
James Bottomley <James.Bottomley@steeleye.com>
Subject: Re: [PATCH] sg: fix leak when dio setup fails
Date: Thu, 30 Mar 2006 13:15:25 -0600 [thread overview]
Message-ID: <200603301315.25447.lgeek@frontiernet.net> (raw)
In-Reply-To: <44299306.4080709@torque.net>
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
prev parent reply other threads:[~2006-03-30 20:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-28 19:48 [PATCH] sg: fix leak when dio setup fails Douglas Gilbert
2006-03-30 19:15 ` Bryan Holty [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200603301315.25447.lgeek@frontiernet.net \
--to=lgeek@frontiernet.net \
--cc=James.Bottomley@steeleye.com \
--cc=dougg@torque.net \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.