[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4ybbkn+nXkGsqWe@unreal>
Date: Sun, 4 Dec 2022 15:06:54 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: netdev@...r.kernel.org, nbd@....name, john@...ozen.org,
sean.wang@...iatek.com, Mark-MC.Lee@...iatek.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
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 Fri, Dec 02, 2022 at 06:36:33PM +0100, Lorenzo Bianconi wrote:
> Introduce __mtk_wed_detach() in order to avoid a possible deadlock in
> mtk_wed_attach routine if mtk_wed_wo_init fails.
>
> Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
> Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> ---
> drivers/net/ethernet/mediatek/mtk_wed.c | 24 ++++++++++++++-------
> drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 10 ++++++---
> drivers/net/ethernet/mediatek/mtk_wed_wo.c | 3 +++
> 3 files changed, 26 insertions(+), 11 deletions(-)
<...>
> diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> index f9539e6233c9..b084009a32f9 100644
> --- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
> @@ -176,6 +176,9 @@ int mtk_wed_mcu_send_msg(struct mtk_wed_wo *wo, int id, int cmd,
> u16 seq;
> int ret;
>
> + if (!wo)
> + return -ENODEV;
<...>
> static void
> mtk_wed_wo_hw_deinit(struct mtk_wed_wo *wo)
> {
> + if (!wo)
> + return;
How are these changes related to the written in deadlock?
How is it possible to get internal mtk functions without valid wo?
Thanks
> +
> /* disable interrupts */
> mtk_wed_wo_set_isr(wo, 0);
>
> --
> 2.38.1
>
Powered by blists - more mailing lists