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

Hi Sylwester,

On 2019년 11월 04일 18:18, Sylwester Nawrocki wrote:
> 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.

You are right. I will send the 2nd version with the missing error handle.

Thanks,
- Seung-Woo Kim

> 
> 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;
>>  }
> 

-- 
Seung-Woo Kim
Samsung Research
--


      reply	other threads:[~2019-11-04  9:34 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
2019-11-04  9:37     ` Seung-Woo Kim [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=5DBFF146.6070903@samsung.com \
    --to=sw0312.kim@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=s.nawrocki@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).