Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1910678rwb; Wed, 26 Jul 2023 22:18:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlFsCwMDE5Uab1NKjehimhd22oO2OMILkLp4tL5o1jA+VJzcP9hU8TMnidlYq25uqpLGOGr9 X-Received: by 2002:a05:6358:431d:b0:134:c37f:4b60 with SMTP id r29-20020a056358431d00b00134c37f4b60mr769962rwc.32.1690435109683; Wed, 26 Jul 2023 22:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690435109; cv=none; d=google.com; s=arc-20160816; b=jkzCcmY4eRZxZTP64Ms28tpvRNHj3uPLtpKyoLaMdzdeVPHznt7Zp3olR63G4R6w8T ztwweXiPRQhZwsbZv/dNoyB1MPHU3hFcUfN2Z/yj9gXQ6I7HbDKSSHHuTA1cwB7mMwtD By+Xud/yiOAdx1nMtGs+lg6OdDzxcD5UPZu4Hx2mv8u0J2ApDiWhEY3eBEGnFUB9muKr +9owE6S/SOnyB5T+kKtrYAULFnLlVN67fiq3hMAr70AmSo9Lo+chyiUaC5s20Ygu6l3G 8c5JTwidXrFSquvyisHUjiu+m6U5tMVyfHuV+h1HG9hIU8+3dyh7gUXNbnXDJGPi3kY1 QBVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=V5HXNXS2Ouf1Hwhar/uIDVeR9Q9dbjXQZM2E0ZXds4Y=; fh=yp0HrahS4uv5P+UwrElB6EHIgmNpDgymzP4APJCQuGU=; b=o0gx8o/utB9cBBfNByJNXn4Zz/p5L56yykK/swnD2TJgSLGwiBFflW1MbynGVWxcDn 96pDL6bYUk9sPA6SRdT5Yn4y7PNYjDphdv578rdPNia7/nwDWK4jgTmy9LLOhuDaOfFs wZYdibPUb1TpQYTFNx4GbC5wogGBvqkmmy7Fg2s83M5zXnckcfG9pbQogm3FyZA1U5hg lQ8AaNegDfeRdbHvEVTOa6S1wi6+7JAqM4BdG5CslkKqRoWj8lciOyK1h6dYKLmphYDo LabMU8F1N9bfm/EcCSiVGBBWkNWhSOqebwGsMtq6GCvo1xWl+EnosaTg4AWPx+CFiamc eh+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pgQpzzB/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 23-20020a631057000000b0054fdfd26dffsi599665pgq.337.2023.07.26.22.18.16; Wed, 26 Jul 2023 22:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pgQpzzB/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbjG0EqS (ORCPT + 99 others); Thu, 27 Jul 2023 00:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229582AbjG0EqQ (ORCPT ); Thu, 27 Jul 2023 00:46:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA8DF2719 for ; Wed, 26 Jul 2023 21:46:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4828D61D23 for ; Thu, 27 Jul 2023 04:46:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43147C433C7; Thu, 27 Jul 2023 04:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690433174; bh=jJ20dTz0Ym/WtEBrhoTt2d94CftbA+6S89ow3P/mlHc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pgQpzzB/RMyil955eazEmMtK4Qjjx8AUa3A+ajzsNcmsUSIl6UmVeFzQTxIK8UrvB 0/2epuF3Cv08aLngfCQg/af9vhAKkvPvpy8yPiNNQqLOR3I7eUBNuR4VxCG3H0Ec+4 QTs/uco97fYzWvdAIaZ7PCu173jYhqOKbXXcjICdjwLnAuOmQYEn3MsprOlrLpfjLr 45k0ZmYGDLCb3/5hjK8MffP9nBU4fA8Q+QvZt+4Gt6JkCcJmPb5UxcmFzC8TZA0nzS tbtqbw00ZDvtxJLDuM23NFE5Jj3OrLIj4znIckTSPIpnLdAhhd95TiVZYqyxoE5Wfx 9uVYqjmg+XI6w== Date: Wed, 26 Jul 2023 21:46:13 -0700 From: Jakub Kicinski To: Chengfeng Ye Cc: isdn@linux-pingi.de, alexanderduyck@fb.com, duoming@zju.edu.cn, yangyingliang@huawei.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mISDN: hfcpci: Fix potential deadlock on &hc->lock Message-ID: <20230726214613.7fee0d7b@kernel.org> In-Reply-To: <20230725173728.13816-1-dg573847474@gmail.com> References: <20230725173728.13816-1-dg573847474@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Jul 2023 17:37:28 +0000 Chengfeng Ye wrote: > As &hc->lock is acquired by both timer _hfcpci_softirq() and hardirq > hfcpci_int(), the timer should disable irq before lock acquisition > otherwise deadlock could happen if the timmer is preemtped by the hadr irq. > > Possible deadlock scenario: > hfcpci_softirq() (timer) > -> _hfcpci_softirq() > -> spin_lock(&hc->lock); > > -> hfcpci_int() > -> spin_lock(&hc->lock); (deadlock here) > > This flaw was found by an experimental static analysis tool I am developing > for irq-related deadlock. > > The tentative patch fixes the potential deadlock by spin_lock_irq() > in timer. > > But the patch could be not enough since between the lock critical section > inside the timer, tx_birq() is called in which a lot of stuff is executed > such as dev_kfree_skb(). I am not sure what's the best way to solve this > potential deadlock problem. Yeah, the dev_kfree_skb() should be dev_kfree_skb_any() or _irq() > Signed-off-by: Chengfeng Ye LGTM, but please repost with a Fixes tag added. -- pw-bot: cr