From: "Tony Battersby" <tonyb@cybernetics.com>
To: marcelo@conectiva.com.br, alan@lxorguk.ukuu.org.uk
Cc: linux-scsi@vger.kernel.org, dougg@torque.net
Subject: Re: [PATCH] 2.4.21 fix race condition in sg.c
Date: Fri, 27 Jun 2003 09:52:04 -0400 [thread overview]
Message-ID: <002901c33cb3$4b262730$e0019d89@cybernetics.com> (raw)
Marcelo & Alan:
This patch against 2.4.21 fixes a race condition in the SCSI generic driver.
It has been approved by Doug Gilbert for inclusion. A similar fix is also
needed for 2.5, although I don't have the 2.5 source tree available to make
a patch.
Note: I have added smp_wmb() since the last time I sent this patch. I think
it is necessary for 100% correctness.
Anthony J. Battersby
Cybernetics
--- drivers/scsi/sg.c.orig Fri Jun 13 10:51:36 2003
+++ drivers/scsi/sg.c Fri Jun 27 09:27:40 2003
@@ -1241,7 +1241,6 @@
SRpnt->sr_request.rq_dev = MKDEV(0, 0); /* "sg" _disowns_ request blk */
srp->my_cmdp = NULL;
- srp->done = 1;
read_unlock(&sg_dev_arr_lock);
SCSI_LOG_TIMEOUT(4, printk("sg...bh: dev=%d, pack_id=%d, res=0x%x\n",
@@ -1274,6 +1273,9 @@
}
/* Rely on write phase to clean out srp status values, so no "else" */
+ smp_wmb();
+ srp->done = 1;
+
scsi_release_request(SRpnt);
SRpnt = NULL;
if (sfp->closed) { /* whoops this fd already released, cleanup */
next reply other threads:[~2003-06-27 13:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-27 13:52 Tony Battersby [this message]
2003-06-27 14:10 ` [PATCH] 2.4.21 fix race condition in sg.c James Bottomley
2003-06-27 14:31 ` Alan Cox
2003-06-27 14:47 ` James Bottomley
2003-06-27 14:57 ` Tony Battersby
2003-06-27 15:00 ` Jeff Garzik
2003-06-27 15:11 ` James Bottomley
2003-06-27 15:38 ` Tony Battersby
-- strict thread matches above, loose matches on Subject: below --
2003-06-26 15:18 Tony Battersby
2003-06-26 22:15 ` Douglas Gilbert
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='002901c33cb3$4b262730$e0019d89@cybernetics.com' \
--to=tonyb@cybernetics.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=dougg@torque.net \
--cc=linux-scsi@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox