linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Seung-Woo Kim <sw0312.kim@samsung.com>, linux-media@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org, mchehab@kernel.org, krzk@kernel.org
Subject: Re: [PATCH] media: exynos4-is: fix wrong mdev and v4l2 dev order in error path
Date: Mon, 4 Nov 2019 10:18:11 +0100	[thread overview]
Message-ID: <fdd591ce-f0b3-8737-bd1f-27645035ce7e@samsung.com> (raw)
In-Reply-To: <1571623084-2705-1-git-send-email-sw0312.kim@samsung.com>

Hi Seung-Woo,

On 10/21/19 03:58, Seung-Woo Kim wrote:
> When driver is built as module and probe during insmod is deferred
> because of sensor subdevs, there is NULL pointer deference because
> mdev is cleaned up and then access it from v4l2_device_unregister().
> Fix the wrong mdev and v4l2 dev odder in error path of probe.

> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>

The patch looks good, however we need to also call media_device_cleanup()
when v4l2_device_register() fails.

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

> ---
>  drivers/media/platform/exynos4-is/media-dev.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> index a838189..3685c91e6 100644
> --- a/drivers/media/platform/exynos4-is/media-dev.c
> +++ b/drivers/media/platform/exynos4-is/media-dev.c
> @@ -1520,8 +1520,8 @@ static int fimc_md_probe(struct platform_device *pdev)
>  err_clk:
>  	fimc_md_put_clocks(fmd);
>  err_md:
> -	media_device_cleanup(&fmd->media_dev);
>  	v4l2_device_unregister(&fmd->v4l2_dev);
> +	media_device_cleanup(&fmd->media_dev);
>  	return ret;
>  }

-- 
Thanks,
Sylwester

  reply	other threads:[~2019-11-04  9:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20191021015536epcas1p3d9dc18f8f4e4a98de0dc7a9a84525cd1@epcas1p3.samsung.com>
2019-10-21  1:58 ` [PATCH] media: exynos4-is: fix wrong mdev and v4l2 dev order in error path Seung-Woo Kim
2019-11-04  9:18   ` Sylwester Nawrocki [this message]
2019-11-04  9:37     ` Seung-Woo Kim

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=fdd591ce-f0b3-8737-bd1f-27645035ce7e@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sw0312.kim@samsung.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;
as well as URLs for NNTP newsgroup(s).