Please consider this for inclusion in the 2.4 kernel.
If no device is attached we now return -ENXIO instead of some bogus numbers.
Prevents applications from trying to access non-existent disks.
cciss.c | 16 ++++------------
1 files changed, 4 insertions(+), 12 deletions(-)
-------------------------------------------------------------------------------
diff -burpN lx2425.orig/drivers/block/cciss.c lx2425-hazard-fix/drivers/block/cciss.c
--- lx2425.orig/drivers/block/cciss.c 2004-03-04 10:16:16.000000000 -0600
+++ lx2425-hazard-fix/drivers/block/cciss.c 2004-03-25 08:52:07.000000000 -0600
@@ -508,12 +508,8 @@ static int cciss_ioctl(struct inode *ino
driver_geo.heads = hba[ctlr]->drv[dsk].heads;
driver_geo.sectors = hba[ctlr]->drv[dsk].sectors;
driver_geo.cylinders = hba[ctlr]->drv[dsk].cylinders;
- } else {
- driver_geo.heads = 0xff;
- driver_geo.sectors = 0x3f;
- driver_geo.cylinders =
- hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
- }
+ } else
+ return -ENXIO;
driver_geo.start=
hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
if (copy_to_user((void *) arg, &driver_geo,
@@ -528,12 +524,8 @@ static int cciss_ioctl(struct inode *ino
driver_geo.heads = hba[ctlr]->drv[dsk].heads;
driver_geo.sectors = hba[ctlr]->drv[dsk].sectors;
driver_geo.cylinders = hba[ctlr]->drv[dsk].cylinders;
- } else {
- driver_geo.heads = 0xff;
- driver_geo.sectors = 0x3f;
- driver_geo.cylinders =
- hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
- }
+ } else
+ return -ENXIO;
driver_geo.start=
hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
if (copy_to_user((void *) arg, &driver_geo,