summaryrefslogtreecommitdiff
path: root/drivers/media/v4l2-core/v4l2-async.c
diff options
context:
space:
mode:
authorSandor Yu <R01008@freescale.com>2015-05-29 17:07:04 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:20:42 +0300
commit6559a9ebcbaea2161a06b2bd36388b640eed200c (patch)
treeeb5adb4d703a53ba57bd516de0a10005b5a8d74e /drivers/media/v4l2-core/v4l2-async.c
parentd716a0d8dbaa5c84530cdfd8ede7dd17ba4cbdcb (diff)
MLK-11508-2 v4l2: Add v4l2_async_notifier_unregister recursively call
If anyone calls v4l2_async_notifier_unregister() recursively from device_release_driver(), code will deadlock at list_lock, so unlock list_lock when device_release_driver() called. Signed-off-by: Sandor Yu <R01008@freescale.com> (cherry picked from commit f0b54df4d1b58f8f6608e1b08a80a5acb8cc12ea)
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-async.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-async.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 5bada202b2d3..76996b516406 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -220,7 +220,14 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
v4l2_async_cleanup(sd);
/* If we handled USB devices, we'd have to lock the parent too */
+ /*
+ * If anyone calls v4l2_async_notifier_unregister() recursively from
+ * device_release_driver(), code will deadlock at list_lock,
+ * so unlock list_lock when device_release_driver() called.
+ */
+ mutex_unlock(&list_lock);
device_release_driver(d);
+ mutex_lock(&list_lock);
if (notifier->unbind)
notifier->unbind(notifier, sd, sd->asd);