aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-25 21:24:43 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-06 03:43:13 -0700
commit041172896309634d3a2065d69f3534de9d111ddd (patch)
treeaa9c1e8c6c0b2fb31d0ac2a5d9293553478b3099
parent16ad6a9070a33c1a624ace8880dd92803228a73d (diff)
downloadlinux-linaro-stable-041172896309634d3a2065d69f3534de9d111ddd.tar.gz
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: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/ieee1394/dv1394.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index 1084da4d88a9..59e383c7d8fd 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -2267,11 +2267,7 @@ static void dv1394_remove_host (struct hpsb_host *host)
{
struct video_card *video;
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 {
@@ -2284,6 +2280,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;
}
}
@@ -2293,8 +2290,9 @@ static void dv1394_remove_host (struct hpsb_host *host)
dv1394_un_init(video);
} while (video != NULL);
- class_device_destroy(hpsb_protocol_class,
- MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)));
+ if (found_ohci_card)
+ 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)