]> err.no Git - linux-2.6/commitdiff
[PATCH] icn driver fails to unload when no hardware present
authorDave Jones <davej@redhat.com>
Mon, 8 Aug 2005 23:13:15 +0000 (16:13 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 8 Aug 2005 23:21:32 +0000 (16:21 -0700)
Fix a null dereference in module unload path.

Found by a simple modprobe icn ; rmmod icn

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/isdn/icn/icn.c

index e0d1b01cc74c5b5badfa64cd2ca1a4a1457b7c68..386df71eee7473f0c7582c26331bdee63c623b68 100644 (file)
@@ -1650,7 +1650,7 @@ static void __exit icn_exit(void)
 {
        isdn_ctrl cmd;
        icn_card *card = cards;
-       icn_card *last;
+       icn_card *last, *tmpcard;
        int i;
        unsigned long flags;
 
@@ -1670,8 +1670,9 @@ static void __exit icn_exit(void)
                        for (i = 0; i < ICN_BCH; i++)
                                icn_free_queue(card, i);
                }
-               card = card->next;
+               tmpcard = card->next;
                spin_unlock_irqrestore(&card->lock, flags);
+               card = tmpcard;
        }
        card = cards;
        cards = NULL;