From 72f678c30185df18ac38ef14c9045d139c2263bc Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Wed, 20 Dec 2006 10:03:53 -0300 Subject: V4L/DVB (4994): Vivi: fix use after free in list_for_each() Freeing data including list_head in list_for_each() is not safe. Signed-off-by: Akinobu Mita Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/vivi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 474ddb77964..3cead24a36c 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -1363,7 +1363,9 @@ static void __exit vivi_exit(void) struct vivi_dev *h; struct list_head *list; - list_for_each(list,&vivi_devlist) { + while (!list_empty(&vivi_devlist)) { + list = vivi_devlist.next; + list_del(list); h = list_entry(list, struct vivi_dev, vivi_devlist); kfree (h); } -- cgit v1.2.3-70-g09d2