lkml.org 
[lkml]   [2004]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectcciss updates [2 of 2]
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,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:01    [W:0.136 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site