From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2BB523A566 for ; Mon, 9 Feb 2026 12:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770640891; cv=none; b=LSOoWAr9hM6h60NhO5+LHGVRfL2JdveSGZZieCtdSZHb+HXDIrlAQlzrVoDz6tHkjP9saDVKhHqKrBupVmfJzI5Pu9iOOfTld62b+Nmoe3157aPk6s2iKtBHAsZCQcIf78bw6lBUZMTrEbHOVuLzcCu2b0jbf7lZCocz1qqBSyo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770640891; c=relaxed/simple; bh=vsXpuBh9zJ1HdsRrSWTQ6CZi7gVDbkh9n51rsUFMkCw=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:To:From: References:In-Reply-To; b=d7rMIWWoLot6Wg5zFN0q1+x5O6F/jia8SqGEvKgJQnfZTZN1aVJ5j2LB5YWnpRpB99+SxwWedv69pBfAfgw8SFrB3rRe+WY5EgR+vpI9HokcBfkGS23NBNfCCYgjWnI03K7O0xU56/j9gEusjFvHyWTGRd9vH8u/3oUENOk1FP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Le1n5iQ0; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Le1n5iQ0" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 0A6F74E42491; Mon, 9 Feb 2026 12:41:29 +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== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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