Commit e55e2cf5 authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by Kamal Mostafa

vivid: Fix iteration in driver removal path

commit a5d42b8c 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: c88a96b0 ('[media] vivid: add core driver code')
Signed-off-by: default avatarEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 44b3ba07
......@@ -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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment