This is a note to let you know that I've just added the patch titled media: hdpvr: fix iteration over uninitialized lists in hdpvr_probe() to the 3.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: media-hdpvr-fix-iteration-over-uninitialized-lists-in-hdpvr_probe.patch and it can be found in the queue-3.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9eb9bfa030d8a49d54f0e4ae671e33f406bbbeff Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov <khoroshilov@xxxxxxxxx> Date: Wed, 3 Jul 2013 16:17:34 -0300 Subject: media: hdpvr: fix iteration over uninitialized lists in hdpvr_probe() From: Alexey Khoroshilov <khoroshilov@xxxxxxxxx> commit 2e923a0527ac439e135b9961e58d3acd876bba10 upstream. free_buff_list and rec_buff_list are initialized in the middle of hdpvr_probe(), but if something bad happens before that, error handling code calls hdpvr_delete(), which contains iteration over the lists (via hdpvr_free_buffers()). The patch moves the lists initialization to the beginning and by the way fixes goto label in error handling of registering videodev. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@xxxxxxxxx> Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx> Signed-off-by: Mauro Carvalho Chehab <m.chehab@xxxxxxxxxxx> [bwh: Backported to 3.2: adjust filename] Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx> Cc: Jianguo Wu <wujianguo@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/media/video/hdpvr/hdpvr-core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/media/video/hdpvr/hdpvr-core.c +++ b/drivers/media/video/hdpvr/hdpvr-core.c @@ -309,6 +309,11 @@ static int hdpvr_probe(struct usb_interf dev->workqueue = 0; + /* init video transfer queues first of all */ + /* to prevent oops in hdpvr_delete() on error paths */ + INIT_LIST_HEAD(&dev->free_buff_list); + INIT_LIST_HEAD(&dev->rec_buff_list); + /* register v4l2_device early so it can be used for printks */ if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { err("v4l2_device_register failed"); @@ -331,10 +336,6 @@ static int hdpvr_probe(struct usb_interf if (!dev->workqueue) goto error; - /* init video transfer queues */ - INIT_LIST_HEAD(&dev->free_buff_list); - INIT_LIST_HEAD(&dev->rec_buff_list); - dev->options = hdpvr_default_options; if (default_video_input < HDPVR_VIDEO_INPUTS) @@ -409,7 +410,7 @@ static int hdpvr_probe(struct usb_interf video_nr[atomic_inc_return(&dev_nr)]); if (retval < 0) { v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); - goto error; + goto reg_fail; } /* let the user know what node this device is now attached to */ Patches currently in stable-queue which might be from khoroshilov@xxxxxxxxx are queue-3.4/hid-hidraw-improve-error-handling-in-hidraw_init.patch queue-3.4/media-hdpvr-fix-iteration-over-uninitialized-lists-in-hdpvr_probe.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html