[3.19.y-ckt stable] Patch "vivid: Fix iteration in driver removal path" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Mon Nov 30 22:10:33 UTC 2015


This is a note to let you know that I have just added a patch titled

    vivid: Fix iteration in driver removal path

to the linux-3.19.y-queue branch of the 3.19.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.19.y-queue

This patch is scheduled to be released in version 3.19.8-ckt11.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.19.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From 1a3c098a9c777ab3492d4e34dde02fc615967012 Mon Sep 17 00:00:00 2001
From: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
Date: Mon, 28 Sep 2015 18:36:51 -0300
Subject: vivid: Fix iteration in driver removal path

commit a5d42b8c3b3ddccd88dc1c70957177d31a6699fb upstream.

When the diver is removed and all the resources are deallocated,
we should be iterating through the created devices only.

Currently, the iteration ends when vivid_devs[i] is NULL. Since
the array contains VIVID_MAX_DEVS elements, it will oops if
n_devs=VIVID_MAX_DEVS because in that case, no element is NULL.

Fixes: c88a96b023d8 ('[media] vivid: add core driver code')

Signed-off-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab at osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/media/platform/vivid/vivid-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c
index a7e033a..d801b57 100644
--- a/drivers/media/platform/vivid/vivid-core.c
+++ b/drivers/media/platform/vivid/vivid-core.c
@@ -1314,8 +1314,11 @@ static void __exit vivid_exit(void)
 	struct vivid_dev *dev;
 	unsigned i;

-	for (i = 0; vivid_devs[i]; i++) {
+
+	for (i = 0; i < n_devs; i++) {
 		dev = vivid_devs[i];
+		if (!dev)
+			continue;

 		if (dev->has_vid_cap) {
 			v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
--
1.9.1





More information about the kernel-team mailing list