From patchwork Thu Apr 28 10:25:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 66885 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp126748qge; Thu, 28 Apr 2016 03:25:21 -0700 (PDT) X-Received: by 10.98.73.23 with SMTP id w23mr19385915pfa.104.1461839121397; Thu, 28 Apr 2016 03:25:21 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i89si623730pfi.95.2016.04.28.03.25.20; Thu, 28 Apr 2016 03:25:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751439AbcD1KZT (ORCPT + 4 others); Thu, 28 Apr 2016 06:25:19 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:39211 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751070AbcD1KZS (ORCPT ); Thu, 28 Apr 2016 06:25:18 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O6C00L1VAA3NM90@mailout1.w1.samsung.com>; Thu, 28 Apr 2016 11:25:15 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-cc-5721e50b6241 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 48.30.05254.B05E1275; Thu, 28 Apr 2016 11:25:15 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O6C002MPA9ZLM80@eusync4.samsung.com>; Thu, 28 Apr 2016 11:25:15 +0100 (BST) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Jacek Anaszewski , Sakari Ailus , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 2/2] media: s3c-camif: fix deadlock on driver probe() Date: Thu, 28 Apr 2016 12:25:04 +0200 Message-id: <1461839104-29135-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1461839104-29135-1-git-send-email-m.szyprowski@samsung.com> References: <1461839104-29135-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjluLIzCtJLcpLzFFi42I5/e/4NV3up4rhBgde61hsnLGe1aL36nNG i9cvDC16NmxltZhxfh+Txdojd9ktDr9pZ7X4tOUbkwOHx7yTgR59W1YxenzeJBfAHMVlk5Ka k1mWWqRvl8CV8f5uK2PBdL6KFZdvMzYwNvF0MXJySAiYSHR3T2ODsMUkLtxbD2RzcQgJLGWU WHDxNxOE08QkcfnLcxaQKjYBQ4mut11gHSICThILZ/1lByliFljKJLHx3HcmkISwgKvE1I0v wGwWAVWJuw3rmEFsXgEPieVHv7NArJOT+P9yBVgNp4CnxNYLF8CGCgHVXP75jXUCI+8CRoZV jKKppckFxUnpuYZ6xYm5xaV56XrJ+bmbGCGh9GUH4+JjVocYBTgYlXh4JyUohguxJpYVV+Ye YpTgYFYS4TV/AhTiTUmsrEotyo8vKs1JLT7EKM3BoiTOO3fX+xAhgfTEktTs1NSC1CKYLBMH p1QDI3dVC5uYyJdZcTd0w5hV3sg2rNidcoilPPT7j78W7eIXq361s0Y6HtV7Wz3xx4XJIlLv fZJFZvzv3dIh9ejHGX3+23MYJ+7kvxIeqZl78Ba/Qd2T1309bQm+xxaun7PjTLPl5HvTCp5E ZKUt8Hu1MrkycXNg/Q/BjrC3qTYpQY8MctyLgxbrKLEUZyQaajEXFScCAHWH6+YhAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Commit 0c426c472b5585ed6e59160359c979506d45ae49 ("[media] media: Always keep a graph walk large enough around") changed media_device_register_entity() function to take mdev->graph_mutex. This causes deadlock in driver probe, which calls (indirectly) this function with ->graph_mutex taken. This patch removes taking ->graph_mutex in driver probe to avoid deadlock. Other drivers don't take ->graph_mutex for entity registration, so this change should be safe. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s3c-camif/camif-core.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c index 0b44b9accf50..af237af204e2 100644 --- a/drivers/media/platform/s3c-camif/camif-core.c +++ b/drivers/media/platform/s3c-camif/camif-core.c @@ -493,21 +493,17 @@ static int s3c_camif_probe(struct platform_device *pdev) if (ret < 0) goto err_sens; - mutex_lock(&camif->media_dev.graph_mutex); - ret = v4l2_device_register_subdev_nodes(&camif->v4l2_dev); if (ret < 0) - goto err_unlock; + goto err_sens; ret = camif_register_video_nodes(camif); if (ret < 0) - goto err_unlock; + goto err_sens; ret = camif_create_media_links(camif); if (ret < 0) - goto err_unlock; - - mutex_unlock(&camif->media_dev.graph_mutex); + goto err_sens; ret = media_device_register(&camif->media_dev); if (ret < 0) @@ -516,8 +512,6 @@ static int s3c_camif_probe(struct platform_device *pdev) pm_runtime_put(dev); return 0; -err_unlock: - mutex_unlock(&camif->media_dev.graph_mutex); err_sens: v4l2_device_unregister(&camif->v4l2_dev); media_device_unregister(&camif->media_dev);