lkml.org 
[lkml]   [2000]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] Fix SCSI proc oops
   Date: Fri, 13 Oct 2000 12:14:29 -0700 (PDT)
From: Linus Torvalds <torvalds@transmeta.com>

On Fri, 13 Oct 2000, Torben Mathiasen wrote:
>
> Yes it works, its not all that different from my patch ;).

Yeah.

The thing I actually cared most about was the comment, which makes the
patch palatable to me.

Linus, why did you apply his patch to _only_ reverse the if condition?

What you applied will crash Sparc again, whereas mine does not crash
the original Sparc case _and_ it fixes Torben's bug too.

Now, if that function is called for a TPNT for which no host adapters
were probed (happens if you compile a driver into the kernel which you
do not have in your machine) it will NULL dereference.

And you _wont_ notice the NULL derefence on ix86 during bootup! Only
other platforms will hit the OOPS due to this error.

Please, the following corrects test10-pre3.

--- ../vanilla/linux/drivers/scsi/scsi.c Fri Oct 13 18:49:31 2000
+++ drivers/scsi/scsi.c Thu Oct 12 18:45:06 2000
@@ -1976,6 +1976,7 @@
struct Scsi_Host *sh1;
struct Scsi_Host *shpnt;
char name[10]; /* host_no>=10^9? I don't think so. */
+ int orig_present;

/*
* First verify that this host adapter is completely free with no pending
@@ -2109,6 +2110,7 @@
* that were detected */

pcount0 = next_scsi_host;
+ orig_present = tpnt->present;
for (shpnt = scsi_hostlist; shpnt; shpnt = sh1) {
sh1 = shpnt->next;
if (shpnt->hostt != tpnt)
@@ -2155,11 +2157,11 @@
(scsi_memory_upper_value - scsi_init_memory_start) / 1024);
#endif

- /*
- * Remove it from the linked list and /proc if all
- * hosts were successfully removed (ie preset == 0)
- */
- if (!tpnt->present) {
+ /* Remove it from the linked list and /proc, but only if
+ * any hosts were registered to begin with _and_ we were
+ * able to remove all of them above.
+ */
+ if (orig_present && !tpnt->present) {
Scsi_Host_Template **SHTp = &scsi_hosts;
Scsi_Host_Template *SHT;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.122 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site