Commit 04117289 authored by Stefan Richter's avatar Stefan Richter Committed by Greg Kroah-Hartman

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
I did not test card ejection with open /dev/dv1394 files yet.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 16ad6a90
...@@ -2267,11 +2267,7 @@ static void dv1394_remove_host (struct hpsb_host *host) ...@@ -2267,11 +2267,7 @@ static void dv1394_remove_host (struct hpsb_host *host)
{ {
struct video_card *video; struct video_card *video;
unsigned long flags; unsigned long flags;
int id = host->id; int id = host->id, found_ohci_card = 0;
/* We only work with the OHCI-1394 driver */
if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME))
return;
/* find the corresponding video_cards */ /* find the corresponding video_cards */
do { do {
...@@ -2284,6 +2280,7 @@ static void dv1394_remove_host (struct hpsb_host *host) ...@@ -2284,6 +2280,7 @@ static void dv1394_remove_host (struct hpsb_host *host)
if ((tmp_vid->id >> 2) == id) { if ((tmp_vid->id >> 2) == id) {
list_del(&tmp_vid->list); list_del(&tmp_vid->list);
video = tmp_vid; video = tmp_vid;
found_ohci_card = 1;
break; break;
} }
} }
...@@ -2293,8 +2290,9 @@ static void dv1394_remove_host (struct hpsb_host *host) ...@@ -2293,8 +2290,9 @@ static void dv1394_remove_host (struct hpsb_host *host)
dv1394_un_init(video); dv1394_un_init(video);
} while (video != NULL); } while (video != NULL);
class_device_destroy(hpsb_protocol_class, if (found_ohci_card)
MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2))); class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR,
IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id << 2)));
} }
static void dv1394_add_host (struct hpsb_host *host) static void dv1394_add_host (struct hpsb_host *host)
......
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