From: Douglas Gilbert <dougg@torque.net>
To: linux-scsi@vger.kernel.org
Cc: lgeek@frontiernet.net
Subject: [PATCH] sg: fix leak when dio setup fails
Date: Tue, 28 Mar 2006 14:48:22 -0500 [thread overview]
Message-ID: <44299306.4080709@torque.net> (raw)
[-- 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;
next reply other threads:[~2006-03-28 19:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-28 19:48 Douglas Gilbert [this message]
2006-03-30 19:15 ` [PATCH] sg: fix leak when dio setup fails Bryan Holty
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=44299306.4080709@torque.net \
--to=dougg@torque.net \
--cc=lgeek@frontiernet.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.