All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Smart <James.Smart@Emulex.Com>
To: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH] Close list corruption window in __scsi_iterate_devices
Date: Tue, 21 Feb 2006 17:28:23 -0500	[thread overview]
Message-ID: <43FB9407.7010102@emulex.com> (raw)

The existing code could allow the use of a list pointer that is
grabbed prior to the lock, changes while waiting for the lock, thus
is no longer valid while the lock is held.

-- james s

--- a/drivers/scsi/scsi.c	2006-02-06 06:01:12.000000000 -0500
+++ b/drivers/scsi/scsi.c.NEW	2006-02-21 17:30:31.000000000 -0500
@@ -1015,11 +1015,12 @@ EXPORT_SYMBOL(scsi_device_put);
  struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *shost,
  					   struct scsi_device *prev)
  {
-	struct list_head *list = (prev ? &prev->siblings : &shost->__devices);
+	struct list_head *list;
  	struct scsi_device *next = NULL;
  	unsigned long flags;

  	spin_lock_irqsave(shost->host_lock, flags);
+	list = (prev ? &prev->siblings : &shost->__devices);
  	while (list->next != &shost->__devices) {
  		next = list_entry(list->next, struct scsi_device, siblings);
  		/* skip devices that we can't get a reference to */

             reply	other threads:[~2006-02-21 22:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-21 22:28 James Smart [this message]
2006-02-21 23:51 ` [Cancel][PATCH] Close list corruption window in __scsi_iterate_devices James Smart

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=43FB9407.7010102@emulex.com \
    --to=james.smart@emulex.com \
    --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.