Re: [PATCH] staging: wfx: correct error handling code in wfx_init_common()
From: Dan Carpenter
Date: Fri Feb 25 2022 - 10:03:55 EST
Thanks, but someone already fixed part of this in linux-next and I think
they sent the patch for the rest, but it just hasn't been applied yet.
> @@ -337,8 +343,10 @@ struct wfx_dev *wfx_init_common(struct device *dev,
> wfx_init_hif_cmd(&wdev->hif_cmd);
> wdev->force_ps_timeout = -1;
>
> - if (devm_add_action_or_reset(dev, wfx_free_common, wdev))
> + if (devm_add_action_or_reset(dev, wfx_free_common, wdev)) {
> + ieee80211_free_hw(hw);
This introduces a double free. The devm_add_action_or_reset() will call
wfx_free_common() on failure.
> return NULL;
> + }
>
> return wdev;
regards,
dan carpenter