fix for sd removal loop
PATCH 1/1 fix for sd removal loop
Attached is a trivial fix for an excessive loop that is encountered in removal of the sd module. This case is hit when sd is insmod'ed and rmmod'ed without any scsi devices being registered. In this case, within exit_sd(), sd_template.dev_max remains at zero and the N_USED_SD_MAJORS macro yields an incorrect result since it is treating dev_max as an signed number.
drivers/scsi/hosts.h +1 -1
@@ -519,7 +519,7 @@unsigned int max_major;/* Maximum major in range. */ unsigned int nr_dev;/* Number currently attached */ unsigned int dev_noticed;/* Number of devices detected. */ -unsigned int dev_max;/* Current size of arrays */ +signed int dev_max;/* Current size of arrays */ unsigned blk:1; /* 0 if character device */int (*detect)(Scsi_Device *);/* Returns 1 if we can attach this device */ int (*init)(void );/* Sizes arrays based upon number of devices
Mike S,
While this fix solves the problem it looks odd to have a signed value for an array size.
What about checking "sd_registered" just afterscsi_unregister_device in exit_sd.
-Mike A
Quoted 20 lines · sullivan [[email protected]] wrote:
Attached is a trivial fix for an excessive loop that is encountered in removal of the sd module. This case is hit when sd is insmod'ed and rmmod'ed without any scsi devices being registered. In this case, within
exit_sd(), sd_template.dev_max remains at zero and theN_USED_SD_MAJORSmacro yields an incorrect result since it is treatingdev_maxas an signed number.diff -Nau --exclude='p.*'
linux-2.5-devclass/drivers/scsi/hosts.hlinux-2.5-devclass-mike/drivers/scsi/hosts.hdrivers/scsi/hosts.h +1
-1@@ -519,7 +519,7 @@unsigned int max_major;/* Maximum major in range. */ unsigned int nr_dev;/* Number currently attached */ unsigned int dev_noticed;/* Number of devices detected. */ -unsigned int dev_max;/* Current size of arrays */ +signed int dev_max;/* Current size of arrays */ unsigned blk:1; /* 0 if character device */int (*detect)(Scsi_Device *);/* Returns 1 if we can attach this device */ int (*init)(void );/* Sizes arrays based upon number of devices
Signature · 2 lines
Michael Anderson [email protected]