Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3093608rwa; Mon, 22 Aug 2022 21:22:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR4uuDJe9oa99H8lWU1zsL807Gl2GGo26s/yxDMiDVnnzQn6Hwi0kXuNDbBsDF25ZvB29DtZ X-Received: by 2002:a17:90b:1804:b0:1fb:141:a09d with SMTP id lw4-20020a17090b180400b001fb0141a09dmr1479428pjb.170.1661228573075; Mon, 22 Aug 2022 21:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661228573; cv=none; d=google.com; s=arc-20160816; b=xbo+FsztsSPa5pKmuzrDgSyIXjOmFkD1Ylz4csKzujpukHZhWLHyhhBVojGgzg0A5b O6oPv4CkNMCvx5vX8VZeerDDpv+ehXZECtiDe7HCnwt4cjvkk8i5nXQpQP1UFNs+Mir1 dAmZatXFx4EszfyzOFbilg3HnR1DhQJksXpOI4pmEHCntPAe9rcTLqRMfaKB/Ucp9DeD gJnkFye/IjDFx0LMZcXq8rpMOfa88BYMx7A4skBnPGGEAb2A8YJpTDkkfKneJB2NkBsM w8iJzabGk3nIoEu36rcyWM6aS02KeIdURY84fqY8jvBGUJN7oNiSP1zN36AIifUL4dGr tbaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:feedback-id:dkim-signature:dkim-signature; bh=DCa1+tn2wL/qaiJJ/v6UFWHx8ak4jYt6XIvYs1ogASU=; b=PT3oItL1nsL3TL8KDCEia1TVFqzpUQvjewlNyRtITw5gVS30JYo/zwtDAuGLcsq4k4 a23enHzUB0AxVxPp/dyHTIQ/hx32cjJI3A+EoMlivl+7TlZxBNni9mILFT9vXoWBFvRJ gC6J7GYiiIppUCmoGhvrdHCYdHf7alir4rfjqiZvjJuGzP7SLkB/5uWkfB5MOL/WmIxV Km/HTDXMPFlUsUY2AyWL96WkYv9Onw/HbiwPPhXbhR/MZXy00652VG83gksz1EVe4hG4 2cK15WG2HiQ0dRHzVMhf/o6c5L2VVEpBBr28yRrT208XWLuV9xaWzq8b6Nhqf+owsd1e qvGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm2 header.b=dNm7xjWc; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ZJm0FM3O; 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=NONE sp=NONE dis=NONE) header.from=sholland.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a056a001a1200b0052bf6789f01si16329430pfv.231.2022.08.22.21.22.42; Mon, 22 Aug 2022 21:22:53 -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=@sholland.org header.s=fm2 header.b=dNm7xjWc; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ZJm0FM3O; 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=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240231AbiHWD5o (ORCPT + 99 others); Mon, 22 Aug 2022 23:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239454AbiHWD5m (ORCPT ); Mon, 22 Aug 2022 23:57:42 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E703C5A2D9; Mon, 22 Aug 2022 20:57:41 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4B0ED5C017D; Mon, 22 Aug 2022 23:57:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 22 Aug 2022 23:57:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1661227061; x= 1661313461; bh=DCa1+tn2wL/qaiJJ/v6UFWHx8ak4jYt6XIvYs1ogASU=; b=d Nm7xjWcTOqvSwz3gYuAarLkMwyk1L93rhjRpVFZPXwz6dFmRC4aCEh7aEUK0CdWn 22sNwpjO0dIWuGu8prCS9bBX1i/IyA51+FVUSZaVQZKK9btir7e4vipNEijX/Tkn vO4fLwEFj2npXJMrqQ81ogpkboWCkX0dDcNBIQtajYby3vP7vl+5G4+8q0EsSro6 eKGOifWHQ/RRa9x3V1G9XLKpm6bqpfKVHRYtE93SlymFQDGo1813dhBhO67xidO1 dgMvadrQ97zo1PBynbXRYJ4ysZzVyxsZOUy/GS2rqLahrz0L/dFcMV2cydJDPfoK YT1+XlAjXjkjmi4KO7diw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1661227061; x= 1661313461; bh=DCa1+tn2wL/qaiJJ/v6UFWHx8ak4jYt6XIvYs1ogASU=; b=Z Jm0FM3OvLfkKYN4sFPWIgRAG1XV2ynPZLtVnBLuBZl62D6YysNIz7b9vkCCrT6hW EPgcH+DIJI5sEeNMzV2E4ArYg+k3sKLSiJ3n1nyV/TKtDwLt0VH6biHkGvPPsiFM i1k04urhL3vAYWBJmKPmE/LzCUpVtL75ZiQREHCOQiECVcsf4pAHlR5gyHBv92C1 bKYLODji5n6xouXrL3ctRK9srwUY83uySJj5Yi2Mi6w3CyLm/O5+7Y4iu6lBmNCJ FqHVHQfFnWwJuYHZXYaEsRr9c2lcFq5ve6ktzx1MuQkW3sV8BeJgEsI3T48Ks8wg qeo2EapXXryyZU/BKS5jw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeikedgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvvehfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpefurghm uhgvlhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenuc ggtffrrghtthgvrhhnpedtvefhheehgfdvkeetffeludeuudehudeuvddtveelleekvedv uedviefhkeeuheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 22 Aug 2022 23:57:40 -0400 (EDT) Subject: Re: [PATCH v1 2/3] media: cedrus: Set the platform driver data earlier To: =?UTF-8?Q?Jernej_=c5=a0krabec?= , linux-media@vger.kernel.org, Maxime Ripard , Paul Kocialkowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , Chen-Yu Tsai , Nicolas Dufresne Cc: 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 References: <20220818203308.439043-1-nicolas.dufresne@collabora.com> <4418189.LvFx2qVVIh@jernej-laptop> <47ce07adc73887b5afaf9815a78b793d0e9a6b54.camel@collabora.com> <4733096.GXAFRqVoOG@jernej-laptop> From: Samuel Holland Message-ID: <0aab3720-7211-9414-0005-6a419b5f04c8@sholland.org> Date: Mon, 22 Aug 2022 22:57:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <4733096.GXAFRqVoOG@jernej-laptop> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 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 >>>> >>>> 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. >>>> Cc: stable@vger.kernel.org >>>> Signed-off-by: Dmitry Osipenko >>>> Signed-off-by: Nicolas Dufresne Please add a Fixes tag. With that: Reviewed-by: Samuel Holland >>>> --- >>>> >>>> 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: