LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2.6.20.4] ieee1394: dv1394: fix CardBus card ejection
@ 2007-03-25 19:24 Stefan Richter
2007-03-25 19:26 ` [PATCH 2.6.16.44] " Stefan Richter
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Richter @ 2007-03-25 19:24 UTC (permalink / raw)
To: stable; +Cc: linux-kernel
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>
---
Picked from 2.6.21-rc1.
drivers/ieee1394/dv1394.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
Index: linux-2.6.20.4/drivers/ieee1394/dv1394.c
===================================================================
--- linux-2.6.20.4.orig/drivers/ieee1394/dv1394.c
+++ linux-2.6.20.4/drivers/ieee1394/dv1394.c
@@ -2267,11 +2267,7 @@ static void dv1394_remove_host (struct h
{
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 h
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 h
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)
--
Stefan Richter
-=====-=-=== --== ==--=
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2.6.16.44] ieee1394: dv1394: fix CardBus card ejection
2007-03-25 19:24 [PATCH 2.6.20.4] ieee1394: dv1394: fix CardBus card ejection Stefan Richter
@ 2007-03-25 19:26 ` Stefan Richter
2007-03-26 22:50 ` Adrian Bunk
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Richter @ 2007-03-25 19:26 UTC (permalink / raw)
To: Adrian Bunk; +Cc: linux-kernel
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>
---
Backport from 2.6.21-rc1.
drivers/ieee1394/dv1394.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
Index: linux-2.6.16.44/drivers/ieee1394/dv1394.c
===================================================================
--- linux-2.6.16.44.orig/drivers/ieee1394/dv1394.c
+++ linux-2.6.16.44/drivers/ieee1394/dv1394.c
@@ -2303,18 +2303,11 @@ static void dv1394_un_init(struct 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 h
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 h
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)));
--
Stefan Richter
-=====-=-=== --== ==--=
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2.6.16.44] ieee1394: dv1394: fix CardBus card ejection
2007-03-25 19:26 ` [PATCH 2.6.16.44] " Stefan Richter
@ 2007-03-26 22:50 ` Adrian Bunk
0 siblings, 0 replies; 3+ messages in thread
From: Adrian Bunk @ 2007-03-26 22:50 UTC (permalink / raw)
To: Stefan Richter; +Cc: linux-kernel
On Sun, Mar 25, 2007 at 09:26:05PM +0200, Stefan Richter wrote:
> 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.
>...
Thanks, applied.
> Stefan Richter
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-26 22:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-25 19:24 [PATCH 2.6.20.4] ieee1394: dv1394: fix CardBus card ejection Stefan Richter
2007-03-25 19:26 ` [PATCH 2.6.16.44] " Stefan Richter
2007-03-26 22:50 ` Adrian Bunk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).