Commit c596cc46 authored by Linus Torvalds's avatar Linus Torvalds

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: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f4921aff
...@@ -5213,6 +5213,10 @@ static int __init gdth_init(void) ...@@ -5213,6 +5213,10 @@ static int __init gdth_init(void)
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count)); TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count));
if (list_empty(&gdth_instances))
return -ENODEV;
#ifdef GDTH_STATISTICS #ifdef GDTH_STATISTICS
TRACE2(("gdth_detect(): Initializing timer !\n")); TRACE2(("gdth_detect(): Initializing timer !\n"));
init_timer(&gdth_timer); init_timer(&gdth_timer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment