lkml.org 
[lkml]   [2003]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectPATCH: ide-proc - fix crash on identify
Date
From
We cannot do an identify on a drive with no driver loaded. The kernel
has a ton of half backed "if no driver" cases but they dont cover all
cases and its a mess.

For now we rely on the probe time identify unless a driver is loaded. A
proper fix (an 'ide-unassigned' driver) will follow later

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.61/drivers/ide/ide-proc.c linux-2.5.61-ac2/drivers/ide/ide-proc.c
--- linux-2.5.61/drivers/ide/ide-proc.c 2003-02-10 18:38:42.000000000 +0000
+++ linux-2.5.61-ac2/drivers/ide/ide-proc.c 2003-02-18 18:06:17.000000000 +0000
@@ -407,20 +407,40 @@
{
ide_drive_t *drive = (ide_drive_t *)data;
int len = 0, i = 0;
+ int err = 0;

- if (drive && !taskfile_lib_get_identify(drive, page)) {
+ len = sprintf(page, "\n");
+
+ if (drive)
+ {
unsigned short *val = (unsigned short *) page;
- char *out = ((char *)val) + (SECTOR_WORDS * 4);
- page = out;
- do {
- out += sprintf(out, "%04x%c",
- le16_to_cpu(*val), (++i & 7) ? ' ' : '\n');
- val += 1;
- } while (i < (SECTOR_WORDS * 2));
- len = out - page;
+
+ /*
+ * The current code can't handle a driverless
+ * identify query taskfile. Now the right fix is
+ * to add a 'default' driver but that is a bit
+ * more work.
+ *
+ * FIXME: this has to be fixed for hotswap devices
+ */
+
+ if(DRIVER(drive))
+ err = taskfile_lib_get_identify(drive, page);
+ else /* This relies on the ID changes */
+ val = (unsigned short *)drive->id;
+
+ if(!err)
+ {
+ char *out = ((char *)page) + (SECTOR_WORDS * 4);
+ page = out;
+ do {
+ out += sprintf(out, "%04x%c",
+ le16_to_cpu(*val), (++i & 7) ? ' ' : '\n');
+ val += 1;
+ } while (i < (SECTOR_WORDS * 2));
+ len = out - page;
+ }
}
- else
- len = sprintf(page, "\n");
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
}

-
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 13:33    [W:0.025 / U:1.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site