[lkml]   [1999]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] ide_open is too permissive
The SCSI code (sd_open) returns -ENXIO if one tries to open
a nonexistent partition of an exiting disk. Good.
But the IDE code just succeeds in the corresponding
situation. This means that attempts to mount a nonexistent
partition yield nonsense like

May 16 14:20:03 nata kernel: 03:0c: rw=0, want=1, limit=0
May 16 14:20:03 nata kernel: attempt to access beyond end of device
May 16 14:20:03 nata kernel: hda<: bad access: block=0, count=1
May 16 14:20:03 nata kernel: end_request: I/O error, dev 03:0c (hda), sector 0

in the syslog. The patch below makes ide_open fail in this situation.
(Maybe the surrounding `if (drive->media == ide_disk)' is too
cautious - I have not thought about what other IDE devices there
are, and what meaning the minor could have for them.)


--- ide.c~ Sat May 15 21:13:29 1999
+++ ide.c Sun May 16 14:37:23 1999
@@ -1672,7 +1672,12 @@
int rc;

if ((drive = get_info_ptr(inode->i_rdev)) == NULL)
- return -ENXIO;
+ return -ENXIO; /* no such drive */
+ if (drive->media == ide_disk) {
+ int minor = (MINOR(inode->i_rdev) & PARTN_MASK);
+ if (drive->part[minor].nr_sects == 0)
+ return -ENXIO; /* no such partition */
+ }
if (drive->driver == NULL)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:51    [W:0.032 / U:11.740 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site