From: Dave Jones Date: Mon, 8 Aug 2005 23:13:15 +0000 (-0700) Subject: [PATCH] icn driver fails to unload when no hardware present X-Git-Tag: v2.6.13-rc7~127 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=138b9dd1fd7b44176af4f3b672060c790b0eaf55;p=linux-2.6 [PATCH] icn driver fails to unload when no hardware present Fix a null dereference in module unload path. Found by a simple modprobe icn ; rmmod icn Signed-off-by: Dave Jones Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index e0d1b01cc7..386df71eee 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c @@ -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;