[PATCH net-next] net: ethernet: mtk_wed: fix possible deadlock if mtk_wed_wo_init fails
Jakub Kicinski
kuba at kernel.org
Mon Dec 5 17:44:41 PST 2022
On Mon, 5 Dec 2022 10:04:07 +0100 Lorenzo Bianconi wrote:
> > IMHO, it is a culprit, proper error unwind means that you won't call to
> > uninit functions for something that is not initialized yet. It is better
> > to fix it instead of adding "if (!wo) ..." checks.
>
> So, iiuc, you would prefer to do something like:
>
> __mtk_wed_detach()
> {
> ...
> if (mtk_wed_get_rx_capa(dev) && wo) {
> mtk_wed_wo_reset(dev);
> mtk_wed_free_rx_rings(dev);
> mtk_wed_wo_deinit(hw);
> }
> ...
>
> Right? I am fine both ways :)
FWIW, that does seem slightly better to me as well.
Also - aren't you really fixing multiple issues here
(even if on the same error path)? The locking,
the null-checking and the change in mtk_wed_wo_reset()?
More information about the Linux-mediatek
mailing list