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 2/2] media: s3c-camif: fix deadlock on driver probe()
Date: Mon, 2 May 2016 15:36:48 +0200 [thread overview]
Message-ID: <572757F0.8000904@xs4all.nl> (raw)
In-Reply-To: <1461839104-29135-2-git-send-email-m.szyprowski@samsung.com>
On 04/28/16 12:25, 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>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Thanks!
Hans
> ---
> drivers/media/platform/s3c-camif/camif-core.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> 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);
>
next prev parent reply other threads:[~2016-05-02 13:36 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 [this message]
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
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=572757F0.8000904@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