[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221205174441.30741550@kernel.org>
Date: Mon, 5 Dec 2022 17:44:41 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: Leon Romanovsky <leon@...nel.org>, netdev@...r.kernel.org,
nbd@....name, john@...ozen.org, sean.wang@...iatek.com,
Mark-MC.Lee@...iatek.com, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, matthias.bgg@...il.com,
linux-mediatek@...ts.infradead.org, lorenzo.bianconi@...hat.com
Subject: Re: [PATCH net-next] net: ethernet: mtk_wed: fix possible deadlock
if mtk_wed_wo_init fails
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()?
Powered by blists - more mailing lists