From: Osama Abdelkader <osama.abdelkader@gmail.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Inki Dae <inki.dae@samsung.com>,
Jagan Teki <jagan@amarulasolutions.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/bridge: samsung-dsim: Fix memory leak in error path
Date: Mon, 9 Feb 2026 19:47:19 +0100 [thread overview]
Message-ID: <aYortxEG3yKPQ8fn@osama> (raw)
In-Reply-To: <DGAFT3L8L5DO.FU8O3M5KTJ40@bootlin.com>
On Mon, Feb 09, 2026 at 01:41:21PM +0100, Luca Ceresoli wrote:
> 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 <osama.abdelkader@gmail.com>
>
> 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 samsung_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!
Sure, I will.
Thanks for letting me know.
>
> [0] https://docs.kernel.org/process/stable-kernel-rules.html
> [1] https://lore.kernel.org/lkml/20260109-drm-bridge-alloc-getput-drm_of_find_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
Hello Luca,
Thank you for the review, I just did that in v2.
Thanks,
Osama
next prev parent reply other threads:[~2026-02-09 18:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-07 18:37 [PATCH] drm/bridge: samsung-dsim: Fix memory leak in error path Osama Abdelkader
2026-02-09 12:41 ` Luca Ceresoli
2026-02-09 18:47 ` Osama Abdelkader [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-02-09 18:41 Osama Abdelkader
2026-02-10 10:44 ` Luca Ceresoli
2026-02-20 14:31 ` Luca Ceresoli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aYortxEG3yKPQ8fn@osama \
--to=osama.abdelkader@gmail.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox