Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c596cc46ba1c5769866efe586daff3422bc31afe
Commit:     c596cc46ba1c5769866efe586daff3422bc31afe
Parent:     f4921aff5b174349bc36551f142a5dbac782ea3f
Author:     Linus Torvalds <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 12:46:16 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 12:46:16 2007 -0700

    scsi/gdth: fix crash in gdth_timeout if no gdth controllers found
    
    If the gdth module is loaded (or compiled in), the gdth_timeout function
    gets started even if no actual gdth controllers are found b the probing.
    
    That ends up not only being unnecessary, but also causes a crash due to
    the function blindly just trying to pick the first entry off the
    "gdth_instances" list, and accessing it - which obviously doesn't work
    if the list is empty!
    
    Noticed by Ingo Molnar.
    
    Tested-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/scsi/gdth.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index e8010a7..3ac080e 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -5213,6 +5213,10 @@ static int __init gdth_init(void)
 #endif /* CONFIG_PCI */
 
        TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count));
+
+       if (list_empty(&gdth_instances))
+               return -ENODEV;
+
 #ifdef GDTH_STATISTICS
        TRACE2(("gdth_detect(): Initializing timer !\n"));
        init_timer(&gdth_timer);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to