public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Samuel Holland <samuel@sholland.org>
Cc: "Jernej Škrabec" <jernej.skrabec@gmail.com>,
	linux-media@vger.kernel.org, "Maxime Ripard" <mripard@kernel.org>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Nicolas Dufresne" <nicolas.dufresne@collabora.com>,
	kernel@collabora.com,
	"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
	stable@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/3] media: cedrus: Set the platform driver data earlier
Date: Tue, 23 Aug 2022 14:22:44 +0200	[thread overview]
Message-ID: <YwTGlENw/7+SDal/@aptenodytes> (raw)
In-Reply-To: <0aab3720-7211-9414-0005-6a419b5f04c8@sholland.org>


[-- Attachment #1.1: Type: text/plain, Size: 2711 bytes --]

Hi,

On Mon 22 Aug 22, 22:57, Samuel Holland wrote:
> On 8/20/22 3:25 AM, Jernej Škrabec wrote:
> > Dne petek, 19. avgust 2022 ob 17:37:20 CEST je Nicolas Dufresne napisal(a):
> >> Le vendredi 19 août 2022 à 06:17 +0200, Jernej Škrabec a écrit :
> >>> Dne četrtek, 18. avgust 2022 ob 22:33:07 CEST je Nicolas Dufresne 
> > napisal(a):
> >>>> From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> >>>>
> >>>> The cedrus_hw_resume() crashes with NULL deference on driver probe if
> >>>> runtime PM is disabled because it uses platform data that hasn't been
> >>>> set up yet. Fix this by setting the platform data earlier during probe.
> >>>
> >>> Does it even work without PM? Maybe it would be better if Cedrus would
> >>> select PM in Kconfig.
> >>
> >> I cannot comment myself on this, but it does not seem to invalidate this
> >> Dmitry's fix.
> > 
> > If NULL pointer dereference happens only when PM is disabled, then it does. I 
> > have PM always enabled and I never experienced above issue.
> 
> There's still a bug even with PM enabled: the v4l2 device is exposed to
> userspace, and therefore userspace could trigger a PM resume, before
> platform_set_drvdata() is called.

Absolutely agreed!

> >>>> Cc: stable@vger.kernel.org
> >>>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> >>>> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> Please add a Fixes tag. With that:
> 
> Reviewed-by: Samuel Holland <samuel@sholland.org>

Same here:

Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Thanks!

Paul

> >>>> ---
> >>>>
> >>>>  drivers/staging/media/sunxi/cedrus/cedrus.c | 4 ++--
> >>>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c
> >>>> b/drivers/staging/media/sunxi/cedrus/cedrus.c index
> >>>> 960a0130cd620..55c54dfdc585c 100644
> >>>> --- a/drivers/staging/media/sunxi/cedrus/cedrus.c
> >>>> +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
> >>>> @@ -448,6 +448,8 @@ static int cedrus_probe(struct platform_device
> >>>> *pdev)
> >>>>
> >>>>  	if (!dev)
> >>>>  		return -ENOMEM;
> >>>>
> >>>> +	platform_set_drvdata(pdev, dev);
> >>>> +
> >>>>  	dev->vfd = cedrus_video_device;
> >>>>  	dev->dev = &pdev->dev;
> >>>>  	dev->pdev = pdev;
> >>>>
> >>>> @@ -521,8 +523,6 @@ static int cedrus_probe(struct platform_device
> >>>> *pdev)
> >>>>
> >>>>  		goto err_m2m_mc;
> >>>>  	}
> >>>>
> >>>> -	platform_set_drvdata(pdev, dev);
> >>>> -
> >>>>  	return 0;
> >>>>  
> >>>>  err_m2m_mc:

-- 
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-08-23 12:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220818203308.439043-1-nicolas.dufresne@collabora.com>
2022-08-18 20:33 ` [PATCH v1 1/3] media: cedrus: Fix watchdog race condition Nicolas Dufresne
2022-08-22  8:04   ` Paul Kocialkowski
2022-08-25 21:02   ` Jernej Škrabec
2022-08-18 20:33 ` [PATCH v1 2/3] media: cedrus: Set the platform driver data earlier Nicolas Dufresne
2022-08-19  4:17   ` Jernej Škrabec
2022-08-19 15:37     ` Nicolas Dufresne
2022-08-20  8:25       ` Jernej Škrabec
2022-08-21 20:40         ` Dmitry Osipenko
2022-08-25 21:04           ` Jernej Škrabec
2022-08-23  3:57         ` Samuel Holland
2022-08-23 12:22           ` Paul Kocialkowski [this message]
2022-08-18 20:33 ` [PATCH v1 3/3] media: cedrus: Fix endless loop in cedrus_h265_skip_bits() Nicolas Dufresne
2022-08-18 20:39   ` Dmitry Osipenko
2022-08-18 21:17     ` Nicolas Dufresne
2022-08-19  4:16   ` Jernej Škrabec
2022-08-19 15:39     ` Nicolas Dufresne
2022-08-25 21:13       ` Jernej Škrabec

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=YwTGlENw/7+SDal/@aptenodytes \
    --to=paul.kocialkowski@bootlin.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=samuel@sholland.org \
    --cc=stable@vger.kernel.org \
    --cc=wens@csie.org \
    /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