From 4841c0b14aa5ea1c5f0380b5ed06d4555973eef1 Mon Sep 17 00:00:00 2001 From: Sandor Yu Date: Fri, 29 May 2015 17:07:04 +0800 Subject: [PATCH] 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 (cherry picked from commit f0b54df4d1b58f8f6608e1b08a80a5acb8cc12ea) --- drivers/media/v4l2-core/v4l2-async.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.17.1