diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-27 00:49:40 +0200 |
---|---|---|
committer | Adrian Bunk <bunk@stusta.de> | 2007-03-27 00:49:40 +0200 |
commit | aaab1c66f78311771aeaeb4f2e9aab8fab3b1c6d (patch) | |
tree | be0af82596a4e76efd96e870f32724574dabf5f9 /drivers | |
parent | 25c72f37099c2f32e8e6c7311735e7a3a036b178 (diff) |
ieee1394: dv1394: fix CardBus card ejection
Fix NULL pointer dereference on hot ejection of a FireWire card while
dv1394 was loaded. http://bugzilla.kernel.org/show_bug.cgi?id=7121
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ieee1394/dv1394.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index efeaa944bd0..9e1a12c59ca 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c @@ -2303,18 +2303,11 @@ static void dv1394_un_init(struct video_card *video) static void dv1394_remove_host (struct hpsb_host *host) { - struct video_card *video; + struct video_card *video, *tmp_vid; unsigned long flags; - int id = host->id; - - /* We only work with the OHCI-1394 driver */ - if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME)) - return; + int id = host->id, found_ohci_card = 0; - /* find the corresponding video_cards */ do { - struct video_card *tmp_vid; - video = NULL; spin_lock_irqsave(&dv1394_cards_lock, flags); @@ -2322,6 +2315,7 @@ static void dv1394_remove_host (struct hpsb_host *host) if ((tmp_vid->id >> 2) == id) { list_del(&tmp_vid->list); video = tmp_vid; + found_ohci_card = 1; break; } } @@ -2329,7 +2323,10 @@ static void dv1394_remove_host (struct hpsb_host *host) if (video) dv1394_un_init(video); - } while (video != NULL); + } while (video); + + if (!found_ohci_card) + return; class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2))); |