Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3661362rwa; Tue, 23 Aug 2022 08:09:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR5OrynSgy0We/Jc7Lz02ZYKm3KwLwtMK5rQqEFuctTJtahFzyB0STQBIvsipHnly37UfCcO X-Received: by 2002:a05:6402:2714:b0:446:eaa5:79f2 with SMTP id y20-20020a056402271400b00446eaa579f2mr4167427edd.22.1661267362762; Tue, 23 Aug 2022 08:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661267362; cv=none; d=google.com; s=arc-20160816; b=ttRiRGVuMJimA0zDZTnuYtKw4x4kmrDQkv3KvkQ66ewqqfBY+42Mp9/6uKkk0wYXgZ PR/6UqpYyVX7PTzs+hm7ION/bYkgDY/qAblSC15xzxIUxe4OEiayiSXCTxVYCvq9vHV/ h/pw2e89z+oL/QLfKl74qSiswLtM9IKTJ+6PWE1cvQvgwzk5V+jyPIFUGC2T8JNk3PD7 BgNo2oZBAOu+SknVEq8yqez5L4SsSxKTWlV43dBsNGW25TR1ChSmwzhrGP/XWncux7WC E/qtPocz5HJSAoLIinas1O5RZfpuwIA6Vxd7goxEDG+yuzBYBLOugpqSxcjU0gxYZzX9 e88w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mH/IsYL2UPBaCXvhJbSLyyoriNuaQXpxdb7a7Mfls2k=; b=eYZOZlRF3PDqIWdvXxpIZqa9eR92+co54UY7PJve5vbsH+8tiUvS6UIoJ/mfJdDEU4 2PjnEM0g1A/mTDONXefTuCmgQhvBUINutfHbApYStpQ014zvaQBgCGTyXJ104VQS+BKz 2GJxq2yCy+uvLVFweCEvzrOSV/+IUZgrQKFnqNkUXoyBZjB6aj2pPniAiOOX2gsD38tJ Nk5whYCms7PPYZqrixpK0eJrG1UPpuHmNZqFw8BojRooDaaMspWga/19Mb4gNQw7Th8t XwPl0BLF0ja0y00O4phCzgNMjoNoetHGbALq3MVhxVvQLJbLGUB7fjA+hioNK6acr1/E TGyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=DAzEwz0Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a05640250c800b004466b488bcasi578636edb.216.2022.08.23.08.08.55; Tue, 23 Aug 2022 08:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=DAzEwz0Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241877AbiHWO6X (ORCPT + 99 others); Tue, 23 Aug 2022 10:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241791AbiHWO6H (ORCPT ); Tue, 23 Aug 2022 10:58:07 -0400 Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [IPv6:2001:4b98:dc4:8::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 544A430A79E; Tue, 23 Aug 2022 05:23:31 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id B6140200004; Tue, 23 Aug 2022 12:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1661257371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mH/IsYL2UPBaCXvhJbSLyyoriNuaQXpxdb7a7Mfls2k=; b=DAzEwz0Yj5FE2S/Gf2B5PDjuh2A9BbgMkrwUgaEn6TEf+aSR3AWc5hjukvQOyOUIX2tjnT VqHvjbLQRHRi83kxjT8K4c88QHMOcDAeSxydZnwV/NPnW4a7B5cx4tytI0vZMGagEYlGT8 Wq9aDliGZjnH+ItFFvPkeblGaypN0er1s0CmnRvpvfPU1uONta8FqtcbSoCU+5A7wM3R3g HdM2rf13SnCK0/ta9Tn4S/AVqUE9mhik4oQhhEYpANOwI6HHZIDL8f7gR+IJ8MFa0ATeWa Gro75d/mDXIQ/4nkvme6/rwYAwas01UqUck8kxNFPfDGk/xTj+J0V38F/WC5ww== Date: Tue, 23 Aug 2022 14:22:44 +0200 From: Paul Kocialkowski To: Samuel Holland Cc: Jernej =?utf-8?Q?=C5=A0krabec?= , linux-media@vger.kernel.org, Maxime Ripard , Mauro Carvalho Chehab , Greg Kroah-Hartman , Chen-Yu Tsai , Nicolas Dufresne , kernel@collabora.com, Dmitry Osipenko , 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 Message-ID: References: <20220818203308.439043-1-nicolas.dufresne@collabora.com> <4418189.LvFx2qVVIh@jernej-laptop> <47ce07adc73887b5afaf9815a78b793d0e9a6b54.camel@collabora.com> <4733096.GXAFRqVoOG@jernej-laptop> <0aab3720-7211-9414-0005-6a419b5f04c8@sholland.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VACStzkiwKlyW1sA" Content-Disposition: inline In-Reply-To: <0aab3720-7211-9414-0005-6a419b5f04c8@sholland.org> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --VACStzkiwKlyW1sA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Mon 22 Aug 22, 22:57, Samuel Holland wrote: > On 8/20/22 3:25 AM, Jernej =C5=A0krabec wrote: > > Dne petek, 19. avgust 2022 ob 17:37:20 CEST je Nicolas Dufresne napisal= (a): > >> Le vendredi 19 ao=C3=BBt 2022 =C3=A0 06:17 +0200, Jernej =C5=A0krabec = a =C3=A9crit : > >>> Dne =C4=8Detrtek, 18. avgust 2022 ob 22:33:07 CEST je Nicolas Dufresn= e=20 > > napisal(a): > >>>> From: Dmitry Osipenko > >>>> > >>>> 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 pro= be. > >>> > >>> 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 th= is > >> Dmitry's fix. > >=20 > > If NULL pointer dereference happens only when PM is disabled, then it d= oes. I=20 > > have PM always enabled and I never experienced above issue. >=20 > 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 > >>>> Signed-off-by: Nicolas Dufresne >=20 > Please add a Fixes tag. With that: >=20 > Reviewed-by: Samuel Holland Same here: Acked-by: Paul Kocialkowski 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 =3D cedrus_video_device; > >>>> dev->dev =3D &pdev->dev; > >>>> dev->pdev =3D pdev; > >>>> > >>>> @@ -521,8 +523,6 @@ static int cedrus_probe(struct platform_device > >>>> *pdev) > >>>> > >>>> goto err_m2m_mc; > >>>> } > >>>> > >>>> - platform_set_drvdata(pdev, dev); > >>>> - > >>>> return 0; > >>>> =20 > >>>> err_m2m_mc: --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --VACStzkiwKlyW1sA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmMExpQACgkQ3cLmz3+f v9Hphgf/RHIkNtIHgUBj1wEt+9CgUUYKzkUCP8Iwi0xIbXLJz4GeHQwIrL8VNnrT 1xZCbn9LrUxPEx48WPdyxs2DMCk3JgIw0M4xGltx8VBPsmRo2GzslC8nWGYt9HyX r3sVL/Vx8GC0Do/yTaTA22LfBQOBOMebdEWZx2M05z/UL5aYC5QLHeaRo88fXqlE RLUhSbWZg3CIRQK4K8aIIa20mW/BpPGvp4af+NqFMezJiY9XsvAmv23dNhnYxZk9 vrkXYKOK5L9WppdzVxqkBGl2jjeKqf5DHAwpIiQaf1iq7DJmdUTPZ193Vs3T9pHC c9btoDAjNoaJGV5Vir/sRaOTUBxmrg== =Aw5f -----END PGP SIGNATURE----- --VACStzkiwKlyW1sA--