Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp3041126lqz; Wed, 3 Apr 2024 17:01:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgTM6WErrh1TfIcyMmx3sevH0IXFcI6SfFf+YQ8aSelkJDrMBWagnWt9KIvNOvGV9lJd7BCLGaFzcJqu75/pvOY6fAEuFr020xgGsRhQ== X-Google-Smtp-Source: AGHT+IESgE2Yk6RZkCbvJg41TizFLonZhEbKvC1fxj8I4y+S7NNj4iq30RamAwnoOCZD1rNCWQK8 X-Received: by 2002:a05:6830:11d0:b0:6e7:39ab:a997 with SMTP id v16-20020a05683011d000b006e739aba997mr774424otq.9.1712188881333; Wed, 03 Apr 2024 17:01:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712188881; cv=pass; d=google.com; s=arc-20160816; b=n0HF9waWn8VcL+lMtr1+rY3a5sU0F32W1Q7/RaJB/duZRb/qzyfyMM/Bf1e5vPSyGk 6j+2nqaQ6gr6sr6ep1INMxZ7xtpYWerZ+hCzKDLw7VihHcO5TWPPzBPnsAArYoLnRlCV 6kGJmjYvW1G0Rh+a4sPUn8olnyZEfjEcnKxUi6uPbEKizhUMWoyDMdmcdMzhCMVh3hBS p5Iaq+JPXtfOuvvhCyUP8glGh6ZHjZvvBI+ic5fNqRDD4OnB/iNbhuqTTe+3QiihVdzH Cvxgs6KWJpNd1aVi2xjqTGBxpXaKce7YNcHDLRMV8KvBWcOKstRJUiIUm3xpvw/K6pt8 Gq3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=CTV/NgE2uaehLRp1uxuc1ER+IIvMg5yvL0MJU6yQlLY=; fh=YWy59erE2W4eBllahHL1VYa5G27LVrJCkzz4xDZdwhE=; b=v2sVQdqIBul0EbVSW5IUmpB/goWeLOdMhuxSasLz+e5mgiSMKkllEJGvZyk3WQq8Rh qpBagMb/8Sd1KNADCE50FE+/4RB/JCaK03QKHM0GXBybD7KZ0fie9vzWjc+c8wXRAdNf 5MQ7AhkQpLn3CJ/Hdlthc+/r5dbaO9JpGi2d8LNPQP1wk1qDOphcHuDG5eW2Z2lHjaR2 uEHOqsI6FhQ7HpryfBTwFI0tOeSHvCT0PapCvkhTyg5r2pyB389Rfxs1WS1Xh8/BGJuu Sbcxwp+vufTWGDDHW7rq36xqLAd+cWO6MhyoK7OeowcV9rtjJQT8j1lJzFxGmX60M1UD zwXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-130759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130759-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k3-20020a0cc783000000b0069168e49ee9si14557960qvj.271.2024.04.03.17.01.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 17:01:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-130759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130759-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0DA881C26B27 for ; Thu, 4 Apr 2024 00:01:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3F181C6A3; Thu, 4 Apr 2024 00:01:15 +0000 (UTC) Received: from mail115-100.sinamail.sina.com.cn (mail115-100.sinamail.sina.com.cn [218.30.115.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7889101E6 for ; Thu, 4 Apr 2024 00:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712188875; cv=none; b=CES5+ur9aA6wrYN8sdRcjEAjViCtPOYmw5ENoFwA93jlAS7CJYYpMcWo46egmffTtnpr906yEbRhgdSKRb7j9FZjUjG0GSQPYFmjgO9gbVkdgKxXU5ZMwKuCNmNe34PRSSALOXNN+G6pxgsdcbrZCyoKnY2uFiakY+mEpmZhGgE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712188875; c=relaxed/simple; bh=eC1aYVYAAKRFGaFrPzu+pNFeosAE4bFpaTP1je5KirM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CDtrwbYdHhouKDmNpQ1kMe9o4xEHgZg9EGF3X0OzDBMK4yr2gRyj16EhZYg6qpuhZhjWv2LrrckqnnYpXDYmuzGaOEnoL6V9UsD99PCW2rRNuc78FJ/HWws+ApX8hgsfMM5qglgthhlJ6oB6/cTX78H22gDhusAjHxdIiooRxE4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.88.48.253]) by sina.com (172.16.235.24) with ESMTP id 660DEDBA00005DD1; Thu, 4 Apr 2024 08:01:01 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 2157745089611 X-SMAIL-UIID: 791D657EF29E45C090CE7142AF62D62F-20240404-080101-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [net?] [nfc?] WARNING: locking bug in nci_close_device (2) Date: Thu, 4 Apr 2024 08:00:49 +0800 Message-Id: <20240404000049.3868-1-hdanton@sina.com> In-Reply-To: <000000000000195eea0615368539@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Wed, 03 Apr 2024 12:49:25 -0700 > syzbot has found a reproducer for the following issue on: > > HEAD commit: fe46a7dd189e Merge tag 'sound-6.9-rc1' of git://git.kernel.. > git tree: upstream > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1201b6d3180000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fe46a7dd189e --- x/net/nfc/nci/core.c +++ y/net/nfc/nci/core.c @@ -560,7 +560,8 @@ static int nci_close_device(struct nci_d */ mutex_lock(&ndev->req_lock); - if (!test_and_clear_bit(NCI_UP, &ndev->flags)) { + if (!test_and_clear_bit(NCI_UP, &ndev->flags) && + !test_bit(NCI_UNREG +1, &ndev->flags)) { /* Need to flush the cmd wq in case * there is a queued/running cmd_work */ @@ -601,6 +602,7 @@ static int nci_close_device(struct nci_d /* Clear flags except NCI_UNREG */ ndev->flags &= BIT(NCI_UNREG); + set_bit(NCI_UNREG +1, &ndev->flags); mutex_unlock(&ndev->req_lock); --