Fix a null dereference in module unload path.

Found by a simple modprobe icn ; rmmod icn

Signed-off-by: Dave Jones <[EMAIL PROTECTED]>

--- linux-2.6.12/drivers/isdn/icn/icn.c~        2005-08-08 18:50:25.000000000 
-0400
+++ linux-2.6.12/drivers/isdn/icn/icn.c 2005-08-08 18:54:13.000000000 -0400
@@ -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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to