From patchwork Thu Apr 28 10:25:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 66886 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp126754qge; Thu, 28 Apr 2016 03:25:22 -0700 (PDT) X-Received: by 10.66.171.164 with SMTP id av4mr19088285pac.135.1461839121694; 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.21; 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 S1751518AbcD1KZT (ORCPT + 4 others); Thu, 28 Apr 2016 06:25:19 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:62946 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750923AbcD1KZS (ORCPT ); Thu, 28 Apr 2016 06:25:18 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O6C00A0VAA32R90@mailout4.w1.samsung.com>; Thu, 28 Apr 2016 11:25:15 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-ca-5721e50b1115 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 87.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 1/2] media: exynos4-is: fix deadlock on driver probe Date: Thu, 28 Apr 2016 12:25:03 +0200 Message-id: <1461839104-29135-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKJMWRmVeSWpSXmKPExsVy+t/xa7rcTxXDDZpWCVtsnLGe1aL36nNG i9cvDC16NmxltZhxfh+Txdojd9ktDr9pZ7X4tOUbkwOHx7yTgR59W1YxenzeJBfAHMVlk5Ka k1mWWqRvl8CVcWjWLOaCAzwVj39vYmpgvMXVxcjJISFgInHt4jYmCFtM4sK99WxdjFwcQgJL GSXaH85lgnCamCQuf3nOAlLFJmAo0fW2iw3EFhFwklg46y87SBGzwFImiY3nvoONEhZwkdg4 pQ8owcHBIqAqcfFkBUiYV8BD4vTZHcwQ2+Qk/r9cwTSBkXsBI8MqRtHU0uSC4qT0XEO94sTc 4tK8dL3k/NxNjJDA+LKDcfExq0OMAhyMSjy8kxIUw4VYE8uKK3MPMUpwMCuJ8Jo/AQrxpiRW VqUW5ccXleakFh9ilOZgURLnnbvrfYiQQHpiSWp2ampBahFMlomDU6qBUULK8KaLTeQM1Vyz ac4ZrJ5/zv8r+7zxt9G1QCmHUzy710tffvL7YoVdQ/BUr/PXxY/FBFyaIhuwljvy1PGrvCwe J5/9XqlVb21998Cy+dqXDltfZ3PYsbsr0vvS6b++3nLt1TbhOxivJzAqycs0Gu2oVFMP6iqO 5grXltSQOZp5/0DeEa8nSizFGYmGWsxFxYkA+vqotwgCAAA= 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/exynos4-is/media-dev.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 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/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 04348b502232..891625e77ef5 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -1448,22 +1448,13 @@ static int fimc_md_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fmd); - /* Protect the media graph while we're registering entities */ - mutex_lock(&fmd->media_dev.graph_mutex); - ret = fimc_md_register_platform_entities(fmd, dev->of_node); - if (ret) { - mutex_unlock(&fmd->media_dev.graph_mutex); + if (ret) goto err_clk; - } ret = fimc_md_register_sensor_entities(fmd); - if (ret) { - mutex_unlock(&fmd->media_dev.graph_mutex); + if (ret) goto err_m_ent; - } - - mutex_unlock(&fmd->media_dev.graph_mutex); ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode); if (ret)