Re: [PATCH] fix: drivers/usb/typec/altmodes: dp_altmode_probe: missing typec_altmode_put_plug on error path
From: Heikki Krogerus
Date: Mon Jul 13 2026 - 05:01:43 EST
Hi,
I hate complain about trivial things, but the subject line has a bit
too much information. You have to improve it.
Please take a look at how the previous commits were written. My
suggestion is that you change it to, for example,
"usb: typec: displayport: Fix a plug altmode leak"
or
"usb: typec: displayport: Add missing typec_altmode_put_plug call"
Thanks,
On Sat, Jun 27, 2026 at 11:41:43AM +0800, WenTao Liang kirjoitti:
> In dp_altmode_probe(), typec_altmode_get_plug() acquires a reference on
> plug. When the data role check fails (TYPEC_HOST check), the function
> returns -EPROTO without calling typec_altmode_put_plug(plug), leaking the
> plug reference. Other error paths (ENODEV, ENOMEM) correctly release the
> reference.
>
> Add typec_altmode_put_plug(plug) before returning on the EPROTO error
> path to fix the leak.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 41294342fad7 ("usb: typec: altmodes/displayport: do not enter mode if port is the UFP")
> Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>
--
heikki