From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4963E81BB0 for ; Mon, 9 Feb 2026 12:41:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43A4610E3D2; Mon, 9 Feb 2026 12:41:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="Le1n5iQ0"; dkim-atps=neutral Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3CEE10E3D2 for ; Mon, 9 Feb 2026 12:41:30 +0000 (UTC) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id B0E49C250FF; Mon, 9 Feb 2026 12:41:36 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BCDEB6074B; Mon, 9 Feb 2026 12:41:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1B51A119D2205; Mon, 9 Feb 2026 13:41:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1770640887; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=cSsgQvh8THNhGe6nGgOwd+lN5eH/AP6yL+drDBDmWyk=; b=Le1n5iQ0reY9YFSYi/FycKd5tr5b+CMHeQClTeemnOBSMFvPOmJ25hZwn2MMAFYsZNNR1V z5i9fAw6jSC1ICG6D3l+ehR1cX6Ptoz4pJ3t0HFCh8WCll8xM75HhHXRGNiXP9xAwRQDmF 2yxmpT4WMc8xMxbLC8STL0bsOhhLA2LdJWX46oBvczGmeNbdbSbkmFzLOIYXP4eQLAGUB1 Sb3ophmiRX6hoCeWOYcqwi5F6lKy+62E1608DY+qB7qw4mUxDMZAs1xy+JjRZmVYXtZWJl 1v1UjmW0TZwsgm0ozpR2wbVMY64PjZ3iWIjD5iS11+xL2l7T+Ucd7U8mtQGBqA== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 09 Feb 2026 13:41:21 +0100 Message-Id: Subject: Re: [PATCH] drm/bridge: samsung-dsim: Fix memory leak in error path To: "Osama Abdelkader" , "Inki Dae" , "Jagan Teki" , "Marek Szyprowski" , "Andrzej Hajda" , "Neil Armstrong" , "Robert Foss" , "Laurent Pinchart" , "Jonas Karlman" , "Jernej Skrabec" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , , From: "Luca Ceresoli" X-Mailer: aerc 0.20.1 References: <20260207183721.43087-1-osama.abdelkader@gmail.com> In-Reply-To: <20260207183721.43087-1-osama.abdelkader@gmail.com> X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hello Osama, On Sat Feb 7, 2026 at 7:37 PM CET, Osama Abdelkader wrote: > In samsung_dsim_host_attach(), drm_bridge_add() is called to add the > bridge. However, if samsung_dsim_register_te_irq() or > pdata->host_ops->attach() fails afterwards, the function returns > without removing the bridge, causing a memory leak. > > Fix this by adding proper error handling with goto labels to ensure > drm_bridge_remove() is called in all error paths. Also ensure that > samsung_dsim_unregister_te_irq() is called if the attach operation > fails after the TE IRQ has been registered. > > Signed-off-by: Osama Abdelkader Good catch! However being a fix you need a 'Fixes:' line pointing to the first commit where hte bug exists. At a quick search it looks like f9bfd326f57e, but please double check that. And with a Fixes tag you need Cc: stable, see the docs [0]. > --- a/drivers/gpu/drm/bridge/samsung-dsim.c > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > @@ -1881,6 +1881,8 @@ static int samsung_dsim_register_te_irq(struct sams= ung_dsim *dsi, struct device > return 0; > } > > +static void samsung_dsim_unregister_te_irq(struct samsung_dsim *dsi); Please don't add a forward declaration. Just move samsung_dsim_unregister_te_irq() function earlier, perhaps right here. Also mention in the commit message that you have just moved it without changes, to help reviewers: unfortunately code being moved it not very well visualized in a diff. Otherwise looks good! It would be great if you please add me in Cc for future patches to this driver. I'm using and touching it [1][2] so I'd like to review patches touching it. Thanks! [0] https://docs.kernel.org/process/stable-kernel-rules.html [1] https://lore.kernel.org/lkml/20260109-drm-bridge-alloc-getput-drm_of_fi= nd_bridge-2-v2-0-8bad3ef90b9f@bootlin.com/ [2] https://lore.kernel.org/lkml/20260206-drm-bridge-atomic-vs-remove-clear= _and_put-v1-2-6f1a7d03c45f@bootlin.com/ Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com