Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1346219pxb; Wed, 2 Feb 2022 02:54:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3pGQ6RaQl7/W/HVpyeSaz0Y2BAneTDLc5XfvHHwWpXrCbxaqXB18HpuOt3d9jDhe3Armq X-Received: by 2002:a17:902:b184:: with SMTP id s4mr3000725plr.7.1643799272292; Wed, 02 Feb 2022 02:54:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643799272; cv=none; d=google.com; s=arc-20160816; b=Y37+AXWg54zVyES9Q2I3Me+IjVSHpZl5N9QOYlE6Gj1g1oWZgLoyYxYbvwNCm94X+0 WKp/hVCd4ym5vsytk5SZkcgXeylNww5S8kdF6AJ1XY4ynsEpya94mvONODRhUspvW17M Sugp7PzznUGmfIxudhgVtEXG+KjXmDfgxrE9ZMTxkTPK583lr1bsolxPkzIIMMWqA4rA Svvn1v0oOhSwqUIdHKo7ynpZ+hCqV6TDkQ6XqaeymWS8XzJgJ4Y56nlskLbWdvrZueuJ RxbOYxVTjPX4v0ap8bKsMOxjSKaLCOuAj9KGur8YGwJnDsrmlYDIOMXfMKegOGLV5qA/ dsKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :mime-version:user-agent:date:message-id:subject:from:cc:to :dkim-signature; bh=EgFo9ghDi1FqlXmS0tqqUfR+YTv3A1qP6YjpJ5SdGs4=; b=LliTzDs/nzo2c4HQcHk1J1QyQHuCG99Cfz6SbajtF1bkdb66LeS/HvdLDzrPKwgU4r d/44OonLwdcND7fPlNzcc6RuWW7AteAvNgEsvSxDPy18DTz7MZpc57WSiCTSjsHHLQCr ux2ekkkwKzGx+c4ju/U28K8Mh1BkyFXnT1ptWYKy9XflfuCsO7JF7RHaULFQYWwvmTK1 NK1ojXE2bnwaSRjsAbSVeXGhAMmaTlu3xFMuvMljsmrLJ6IOF4jiRU4kPvJUOJHCWSaf 3gLC9W9VowvwYP8vsXjj4lxz2GCA05i45EUWuwQh5ZyeIx7/96J2hWdOakzpjJd0emgy FBzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MzCFBVr9; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k15si21904660plk.517.2022.02.02.02.54.20; Wed, 02 Feb 2022 02:54:32 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=MzCFBVr9; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235251AbiBAHvk (ORCPT + 99 others); Tue, 1 Feb 2022 02:51:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234355AbiBAHvi (ORCPT ); Tue, 1 Feb 2022 02:51:38 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B4DC061714; Mon, 31 Jan 2022 23:51:38 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id o64so16366675pjo.2; Mon, 31 Jan 2022 23:51:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=EgFo9ghDi1FqlXmS0tqqUfR+YTv3A1qP6YjpJ5SdGs4=; b=MzCFBVr9tw3Mbk9jsA9GWZSlDw7uVe2T+SDT1T2Yb/1woqWGpTgpz9n1nTj/1MEjLA xJS3uA+zVLriZi1Emc8tBO/+WalEJTJ3OraYh2aa5ryThSPaE4QP/CfyHgHJFheQIVZj xVxoK11XToKt4TlfvFFBPzBNkukPDTxEy9qZL/mcBkdlhTkMOvrPF1BxVXqluP04qzTg LOtybm2gzIf984S+dkpEMiZVAHK17M139Af2ekd8kC95uvx/1MFeWjKY701HGT5zj1qF ZOoXa8eRQspeeakcyC8h0UtkqrScNiVXrLDYWAjvupqzxn6/XDrlYu9H/k4sgVRTATSH ay3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=EgFo9ghDi1FqlXmS0tqqUfR+YTv3A1qP6YjpJ5SdGs4=; b=bUrJR4KhOEEEdUR+2LNbQXFz9MQyGur1RxapH3gaDiEL6SebJ8SWnJ5Tp8b9Mwo4/L pxgISWCzc1Nh+niyKx3DNzD9LlVH792OXsyXGAImC8p6enhnBJSTMoiiYrciXC8Cv/QG VqFOitQ3BXFNidFNgmQtb1qeGw3gaNyt0DxtAk+E2o0ihn5X7/zkxseSUrvt8RIapQ0Q c4t3JXSVxZ1qZGiWMfMbe+lRD3yFAiiDkLBRP8XZtExafFQrJu2J1+AMhK1bX8nXEuCr uHIOn8h+97S5yoyBE5VD3QrGbfhGGVqvtlOtLOrTR3K5llGk8bk7Zj+obDgr0dDYFCQR UjEA== X-Gm-Message-State: AOAM531CImhjP20Ku+z0w7CIFc5n5kQihvNUEPEnC7bcROoSlL7pc/mn G/glNUKEuDZci7KteZjnahlSLd2aZXk= X-Received: by 2002:a17:90a:7a8a:: with SMTP id q10mr908260pjf.55.1643701898019; Mon, 31 Jan 2022 23:51:38 -0800 (PST) Received: from [10.59.0.6] ([85.203.23.80]) by smtp.gmail.com with ESMTPSA id 9sm1634502pjl.55.2022.01.31.23.51.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Jan 2022 23:51:37 -0800 (PST) To: kgraul@linux.ibm.com, davem@davemloft.net, kuba@kernel.org Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel From: Jia-Ju Bai Subject: [BUG] net: smc: possible deadlock in smc_lgr_free() and smc_link_down_work() Message-ID: <11fe65b8-eda4-121e-ec32-378b918d0909@gmail.com> Date: Tue, 1 Feb 2022 15:51:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, My static analysis tool reports a possible deadlock in the smc module in Linux 5.16: smc_lgr_free()   mutex_lock(&lgr->llc_conf_mutex); --> Line 1289 (Lock A)   smcr_link_clear()     smc_wr_free_link()       wait_event(lnk->wr_tx_wait, ...); --> Line 648 (Wait X) smc_link_down_work()   mutex_lock(&lgr->llc_conf_mutex); --> Line 1683 (Lock A)   smcr_link_down()     smcr_link_clear()       smc_wr_free_link()         smc_wr_wakeup_tx_wait()           wake_up_all(&lnk->wr_tx_wait); --> Line 78 (Wake X) When smc_lgr_free() is executed, "Wait X" is performed by holding "Lock A". If smc_link_down_work() is executed at this time, "Wake X" cannot be performed to wake up "Wait X" in smc_lgr_free(), because "Lock A" has been already hold by smc_lgr_free(), causing a possible deadlock. I am not quite sure whether this possible problem is real and how to fix it if it is real. Any feedback would be appreciated, thanks :) Best wishes, Jia-Ju Bai