Re: [PATCH 0/5] rtw_sdio_if1_init cleanup and small logic tweak

From: Dan Carpenter

Date: Wed Apr 01 2026 - 06:38:09 EST


On Wed, Apr 01, 2026 at 12:17:41PM +0200, Luka Gejak wrote:
> Hi Omer,
> Thank you for submitting this patch series. I like the idea, however
> during my review I have found that there are several issues.
>
> Patch 1:
> While the patch makes it visually cleaner, this patch introduces a
> significant risk of a kernel panic. struct net_device *pnetdev; is
> declared on the stack but not initialized to NULL. If the function
> fails early, the execution jumps to the free_adapter label. The logic
> then evaluates if (pnetdev). Since pnetdev contains uninitialized
> stack garbage, this check will likely evaluate to true, causing the
> kernel to attempt rtw_free_netdev() on a random memory address.

That's not true.

regards,
dan carpenter