Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC9A9606A325 for ; Tue, 1 Dec 2026 09:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=WKp0yKjb Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 421CB10E43B; Tue, 1 Dec 2026 09:13:32 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id A121F10E43B for ; Tue, 1 Dec 2026 09:13:26 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2A72D1762 for ; Tue, 1 Dec 2026 01:13:23 -0800 (PST) Received: from [10.2.11.19] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BD2B13F7D8 for ; Tue, 1 Dec 2026 01:13:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796116406; bh=dJbCk+sEiYLLU0dcDg/MmU+afvdti93oetLyqsBrY2I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WKp0yKjbm6aBneS7PnBU6VwYets083gSXE/n3rDkyHF/SxTHf0UbWyxpPw9fGe1wB /A8ohM24Lf972FxS6vL7qGBeMQ0N+GGakCQGnhYMaxQv1UtUf6ClE6nfnMHHX9NQ/E 23xACliAtcjNLVq0mIU3hxko/SDNcpBexeEWS7Uk= Date: Tue, 1 Dec 2026 09:13:18 +0000 From: Liviu Dudau To: Luca Ceresoli Cc: Luo Liu , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Russell King , dri-devel@lists.freedesktop.org, Ayan Halder , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Kory Maincent , David Airlie , Simona Vetter , linux-kernel@vger.kernel.org, cix-kernel-upstream@cixtech.com, Wuyi.Shen@cixtech.com Subject: Re: [PATCH v6 3/3] drm/komeda: Free the IRQ before clearing dev_private Message-ID: References: <20261201032435.969586-1-Luo.Liu@cixtech.com> <20261201032435.969586-4-Luo.Liu@cixtech.com> <179611484744.647574.2802243177232479190.b4-review@b4> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <179611484744.647574.2802243177232479190.b4-review@b4> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Tue, Dec 01, 2026 at 09:47:27AM +0100, Luca Ceresoli wrote: > > The interrupt is requested with devm_request_irq(), so it remains > > registered until the device is removed and its devres resources are > > released. komeda_kms_detach(), and the komeda_kms_attach() error path > > taken when drm_dev_register() fails, clear drm->dev_private before that, > > while komeda_kms_irq_handler() still reads mdev from it. The interrupt > > line is shared, so another device can raise it in that window and make > > the handler dereference a NULL pointer. > > > > Free the interrupt explicitly with devm_free_irq() before dropping > > drm->dev_private. free_irq() removes the action and synchronizes with > > any handler in flight, so the handler cannot run afterwards. > > > > Fixes: 2cfb1981dd0d ("drm/komeda: Make Komeda interrupts shareable") > > Reviewed-by: Liviu Dudau > > Signed-off-by: Luo Liu > > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > index f55770511276..ebf4459eb209 100644 > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > @@ -336,6 +336,7 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) > > > > free_interrupts: > > drm_kms_helper_poll_fini(drm); > > + devm_free_irq(drm->dev, mdev->irq, drm); > > cleanup_private_objs: > > komeda_kms_cleanup_private_objs(mdev); > > drm->dev_private = NULL; > > @@ -350,6 +351,8 @@ void komeda_kms_detach(struct komeda_kms_dev *kms) > > drm_dev_unregister(drm); > > drm_kms_helper_poll_fini(drm); > > drm_atomic_helper_shutdown(drm); > > + /* The handler dereferences drm->dev_private, which is about to go. */ > > + devm_free_irq(drm->dev, mdev->irq, drm); > > komeda_kms_cleanup_private_objs(mdev); > > drm->dev_private = NULL; > > } > > The patch looks ok: > > Reviewed-by: Luca Ceresoli > > However it's better if you send fixes in a separate series as suggested by > Köry in v4. But if you send them in the same series, at least have fixes > before features. This is because in DRM fixes are applied to a different > branch, so a fix after a feature patch might just fail to apply. Yeah, but we're in -rc5 now and the fixes are not critical, so I'll push the whole series into drm-misc-next. Stable will pick the fixes up once they get merged into a public release. Best regards, Liviu > > This was a suggestion for future series. For this series, I'd not add more > noise by splitting this patch into yet another sub-series. oving it as the > first patch should be enough. > > Luca > > -- > Luca Ceresoli, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯