From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C409C4332F for ; Sun, 4 Dec 2022 13:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbiLDNHK (ORCPT ); Sun, 4 Dec 2022 08:07:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiLDNHI (ORCPT ); Sun, 4 Dec 2022 08:07:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2172217899 for ; Sun, 4 Dec 2022 05:07:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8AE1B8075D for ; Sun, 4 Dec 2022 13:07:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A5E5C433C1; Sun, 4 Dec 2022 13:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670159222; bh=chlRnalb7pVdKBbL3xGD8d14nSvltNKVeqlHVirWbRo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UQx82WapAzgvTFf5/1aEQLF7JcEQ7XSfQDR/4FGloJIsltQBF3dW7GctJe711/AG/ GmEcukTONqrDRD3Y82mUrqc6FibQSBOrK0mVMtR4LHpldUNO6rUnhyT514RTqnGiFa iy6yJXrk2rz4i+PqXfAGCBF13Yjt0ui1zDOjfxraKniawbmtqvWDD+2OSXvYmAeYlA uOFAHlbOVGRklSFyyc3v+G8f42P7G5PO4vAP5FNABmOjMwMEb0u2BVtte1oUdIQJFc OVLaX2Xn9NGOGTTDig/8JJFN4wZqKlJdRGiFKGuY+6nveEVzJJSpJsRIZWRwfLbUrC iILT8FIZXkzkQ== Date: Sun, 4 Dec 2022 15:06:54 +0200 From: Leon Romanovsky To: Lorenzo Bianconi Cc: netdev@vger.kernel.org, nbd@nbd.name, john@phrozen.org, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org, lorenzo.bianconi@redhat.com Subject: Re: [PATCH net-next] net: ethernet: mtk_wed: fix possible deadlock if mtk_wed_wo_init fails Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 > --- > 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 >