Re: [PATCH] usb: host: sl811_cs: fix memory leak on probe failure
From: Nikolay Kulikov
Date: Fri Aug 28 2026 - 13:36:42 EST
On Thu, Aug 27, 2026 at 03:41:20PM +0800, Zongmin Zhou wrote:
> From: Zongmin Zhou <zhouzongmin@xxxxxxxxxx>
>
> sl811_cs_probe() leaks the local_info_t allocated into link->priv when
> sl811_cs_config() fails: the only kfree() lives in the remove callback
> sl811_cs_detach(), which the PCMCIA core never calls for a device whose
> probe failed.
>
> Free the private data when sl811_cs_config() fails.
>
> Fixes: c6de2b64eb57 ("[PATCH] USB: add sl811_cs support")
The code looks good to me, but I have a question regarding the Fixes
tag.
In the commit you cited, a failure triggered a call to
sl811_cs_detach(), which freed that memory. However, that behavior was
changed in commit
f8cfa618dccb ("[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback")
where the call was removed, leaving the memory unfreed. Shouldn't that
be the commit referenced in the Fixes?
Thanks,
Nikolay