public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Jacek Anaszewski <j.anaszewski@samsung.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH 1/2] media: exynos4-is: fix deadlock on driver probe
Date: Mon, 2 May 2016 00:09:54 +0200	[thread overview]
Message-ID: <57267EB2.3050909@xs4all.nl> (raw)
In-Reply-To: <1461839104-29135-1-git-send-email-m.szyprowski@samsung.com>

On 04/28/2016 12:25 PM, Marek Szyprowski wrote:
> 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 <m.szyprowski@samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

	Hans

> ---
>  drivers/media/platform/exynos4-is/media-dev.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> 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)
> 

      parent reply	other threads:[~2016-05-01 22:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 10:25 [PATCH 1/2] media: exynos4-is: fix deadlock on driver probe Marek Szyprowski
2016-04-28 10:25 ` [PATCH 2/2] media: s3c-camif: fix deadlock on driver probe() Marek Szyprowski
2016-05-02 13:36   ` Hans Verkuil
2016-05-01 21:59 ` [PATCH 1/2] media: exynos4-is: fix deadlock on driver probe Sakari Ailus
2016-05-02 10:52   ` Mauro Carvalho Chehab
2016-05-02 11:00     ` Hans Verkuil
2016-05-01 22:09 ` Hans Verkuil [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57267EB2.3050909@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=b.zolnierkie@samsung.com \
    --cc=j.anaszewski@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=s.nawrocki@samsung.com \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox