From: Sandor Yu Date: Fri, 29 May 2015 09:07:04 +0000 (+0800) Subject: MLK-11508-2 v4l2: Add v4l2_async_notifier_unregister recursively call X-Git-Tag: C0P2-H0.0--20200415~4274 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=4841c0b14aa5ea1c5f0380b5ed06d4555973eef1;p=linux.git 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) --- 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);