diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-01-27 07:52:52 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-02-08 15:00:48 -0500 |
commit | 88e7bf2a4c35d1200c2f72f5cd3d9e72c7f6c890 (patch) | |
tree | 9d91a89b20d668c49f774e73da74d2a1ec5aad1b /drivers/ieee1394 | |
parent | beb2fdcad14af14fa38d5098003bd0f53e1c1185 (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
I did not test card ejection with open /dev/dv1394 files yet.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/dv1394.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 1084da4d88a9..d636cfad7fcf 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -2267,11 +2267,7 @@ static void dv1394_remove_host (struct hpsb_host *host) | |||
2267 | { | 2267 | { |
2268 | struct video_card *video; | 2268 | struct video_card *video; |
2269 | unsigned long flags; | 2269 | unsigned long flags; |
2270 | int id = host->id; | 2270 | int id = host->id, found_ohci_card = 0; |
2271 | |||
2272 | /* We only work with the OHCI-1394 driver */ | ||
2273 | if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME)) | ||
2274 | return; | ||
2275 | 2271 | ||
2276 | /* find the corresponding video_cards */ | 2272 | /* find the corresponding video_cards */ |
2277 | do { | 2273 | do { |
@@ -2284,6 +2280,7 @@ static void dv1394_remove_host (struct hpsb_host *host) | |||
2284 | if ((tmp_vid->id >> 2) == id) { | 2280 | if ((tmp_vid->id >> 2) == id) { |
2285 | list_del(&tmp_vid->list); | 2281 | list_del(&tmp_vid->list); |
2286 | video = tmp_vid; | 2282 | video = tmp_vid; |
2283 | found_ohci_card = 1; | ||
2287 | break; | 2284 | break; |
2288 | } | 2285 | } |
2289 | } | 2286 | } |
@@ -2293,8 +2290,9 @@ static void dv1394_remove_host (struct hpsb_host *host) | |||
2293 | dv1394_un_init(video); | 2290 | dv1394_un_init(video); |
2294 | } while (video != NULL); | 2291 | } while (video != NULL); |
2295 | 2292 | ||
2296 | class_device_destroy(hpsb_protocol_class, | 2293 | if (found_ohci_card) |
2297 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2))); | 2294 | class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, |
2295 | IEEE1394_MINOR_BLOCK_DV1394 * 16 + (host->id << 2))); | ||
2298 | } | 2296 | } |
2299 | 2297 | ||
2300 | static void dv1394_add_host (struct hpsb_host *host) | 2298 | static void dv1394_add_host (struct hpsb_host *host) |