All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <mikenc@us.ibm.com>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] fix oops caused when writing to the rescan attribute
Date: Tue, 30 Sep 2003 15:27:18 -0700	[thread overview]
Message-ID: <3F7A0346.9090309@us.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

If an upper layer driver is not loaded, and you write to a device's 
rescan attribute you will get an oops. The attached patch fixes this by 
testing if the device's driver variable is set before accessing it.


Mike Christie
mikenc@us.ibm.com

[-- Attachment #2: sysfs_rescan.patch --]
[-- Type: text/plain, Size: 479 bytes --]

--- linux-2.6.0-test6/drivers/scsi/scsi_scan.c	2003-09-27 17:50:40.000000000 -0700
+++ linux-2.6.0-test6-work/drivers/scsi/scsi_scan.c	2003-09-30 04:12:25.000000000 -0700
@@ -1080,8 +1080,12 @@
 
 void scsi_rescan_device(struct device *dev)
 {
-	struct scsi_driver *drv = to_scsi_driver(dev->driver);
+	struct scsi_driver *drv;
+	
+	if (!dev->driver)
+		return;
 
+	drv = to_scsi_driver(dev->driver);
 	if (try_module_get(drv->owner)) {
 		if (drv->rescan)
 			drv->rescan(dev);

                 reply	other threads:[~2003-09-30 22:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3F7A0346.9090309@us.ibm.com \
    --to=mikenc@us.ibm.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.