]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] fix intermittent oops in scsi_bus_uevent
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Thu, 22 May 2008 11:34:41 +0000 (12:34 +0100)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 23 May 2008 21:17:06 +0000 (16:17 -0500)
Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
> BUG: unable to handle kernel paging request at e6f17fac
> IP: [<c02604d6>] scsi_bus_uevent+0x1/0x17
> *pde = 2714b163 *pte = 26f17160
> Oops: 0000 [#1] DEBUG_PAGEALLOC
> last sysfs file:
>
> Pid:  1, comm: swapper Not tainted (2.6.26-rc2-next-20080516skw #30)
> EIP: 0060:[<c02604d6>] EFLAGS: 00010282 CPU: 0
> EIP is at scsi_bus_uevent+0x1/0x17
> EAX: e6f18014 EBX: e6f18014 ECX: c02604d5 EDX: e7173000
> ESI: e7173000 EDI: e7173000 EBP: e7851ca0 ESP: e7851c90
>  DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068

The problem is caused by:

commit b0ed43360fdca227048d88a08290365cb681c1a8
Author: Hannes Reinecke <hare@suse.de>
Date:   Tue Mar 18 14:32:28 2008 +0100

    [SCSI] add scsi_host and scsi_target to scsi_bus

which added scsi_bus_type to the struct scsi_target device.  This
causes both the scsi_device and scsi_target to fire scsi_bus_uevents.
However, the actualy scsi_bus_uevent() call assumes blindly that it's
a struct scsi_device.  Check for this and return immediately if it
isn't.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/scsi_sysfs.c

index 049103f1d16ffd320ca51a5544aca1966dc71585..93d2b6714453e6ae7e11f1cd2e3b864182f7d66d 100644 (file)
@@ -359,7 +359,12 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
 
 static int scsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
-       struct scsi_device *sdev = to_scsi_device(dev);
+       struct scsi_device *sdev;
+
+       if (dev->type != &scsi_dev_type)
+               return 0;
+
+       sdev = to_scsi_device(dev);
 
        add_uevent_var(env, "MODALIAS=" SCSI_DEVICE_MODALIAS_FMT, sdev->type);
        return 0;