summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2006-12-20 10:03:53 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-12-27 14:20:07 -0200
commit72f678c30185df18ac38ef14c9045d139c2263bc (patch)
tree1c9c159c925bea6af264f4497c6ee6334d94f911 /drivers/media
parentb331daa03cd949b1b0a4b761b4b4a92d71f7d626 (diff)
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 <akinobu.mita@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/vivi.c4
1 files changed, 3 insertions, 1 deletions
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);
}