Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp188200lqe; Thu, 4 Apr 2024 03:59:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbkOHwyfDb9tTQ0ySL17Q2K3mxxkuo1FH/gTYQkrqqh1H9P+gCLmqo5+uMkXVfL1z7iHwGcl+lOtPFyxbeJjKXRWDZ+NcUNmCySrVPVA== X-Google-Smtp-Source: AGHT+IGFJ2ypbaPAjyKGDRiQfjOk9r5cJDVMQIjGfQEmFbtR8sgGToFWNmd7hRj5vOFGrNNve3BO X-Received: by 2002:a50:d494:0:b0:56d:f54a:8764 with SMTP id s20-20020a50d494000000b0056df54a8764mr1512909edi.39.1712228384156; Thu, 04 Apr 2024 03:59:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712228384; cv=pass; d=google.com; s=arc-20160816; b=0BoaTRy6Z2X+Zw1wWpSMXYz9WWncSOrmdMlQaI1We5KOrWzevvDbCYwpPDhXtVilK5 gt5qQ19/vBvR5/Amq8CO4eAyl5ErUIFiFLCSgWZHXvsw6cXCPPwlRd+tJVSOGUCr/hbO PyjPvB7N/bQtbHgyyrr70vEGBpvYonaSkRrL85TATlODI1wxlmPKDb5maq1Kw3NXvRp1 jEn0PQ9NyYG545L4ESIVZaj2vaMB8oR7fXU8oFj1eD7gBQP1IGKoeo1mA+cSvup8oumj FinEbNA/rDtKcbonkz48vhDCmlEICTYS3/jbNoDSPEeGJE4D+WYwxYNAeZzGZk9L3s5h YUIg== 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=z9peEq9ocbFCgZFXRHKmN1CNRxVrGzTQrFWOWQUFTEs=; fh=YWy59erE2W4eBllahHL1VYa5G27LVrJCkzz4xDZdwhE=; b=oJtsTOx8FFidVxClAtWSDPIRzddzUi+6eRYdivhACJNtvyvILImy6VP79a2zZQWr/T TQizwNHk9dOfLSZNIUdLxjp+WCa4RoQdpxc/DZUqt7gMCDLazxkL/SJmaFWwHaBDPAz3 008Ohb6RGpl1YRQd79aVGOj6oT40d7SDBKzvApBSMYO5nTu+CBw/224me311kpktxKR0 uvH+Dl9HW9483MYOas5WUY8Qp/fEI8DG+VDp2i0KPsC3cyfM9Tkpu0y4YgTFf5uvX2l5 VCgP9OaJVOqOdL0UA8BQaLbqYjv0eCnyCOfHbSBR7HMvGPpJpi0IWrWCcEsV1N7gJHqD MK3A==; 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-131274-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131274-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o28-20020a509b1c000000b0056e050fc2edsi1721004edi.141.2024.04.04.03.59.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 03:59:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131274-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-131274-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131274-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 am.mirrors.kernel.org (Postfix) with ESMTPS id DB7A71F24225 for ; Thu, 4 Apr 2024 10:59:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DAE48286A; Thu, 4 Apr 2024 10:59:22 +0000 (UTC) Received: from mail115-76.sinamail.sina.com.cn (mail115-76.sinamail.sina.com.cn [218.30.115.76]) (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 230D180611 for ; Thu, 4 Apr 2024 10:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712228361; cv=none; b=iU/FP38M12KS/VJYf9Ro09GwZGlCb0nYTaz909YnMTgbNeZV2fkqDXZRvgVaKBcqnORWc0ZtLcTqvh6lSUlfni+LNqJTihuzNO0l3lgRix2KVolUw5zxzAPKD7MUR9I+7ajHkevvo2eBZ0TjuN+0igqMEOojtp/kWsiar/yg7i4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712228361; c=relaxed/simple; bh=r9fki0uwP9xnEv19ryG/styyswsIaC53CUwytQDYMtQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qJS51BP2q7SVtAzfwKn3IwjhzKG3kAEisjiLLhyvB919pIj+0wFG/rhsAKekTIfgVIq98MSVeZT3M2ybmGG76SPmPh2r5t5d4TxezTMPD75m71271IwV++5L2voApsSl9ANHbwJ1KcdMpPlbimATRts6AGhXTBVRugtZNKx0xqE= 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.76 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 (10.75.12.45) with ESMTP id 660E87F80000589D; Thu, 4 Apr 2024 18:59:06 +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: 6585231457660 X-SMAIL-UIID: 36321F20FE894DE38A277A00B2A0356B-20240404-185906-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 18:58:53 +0800 Message-Id: <20240404105853.4079-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,6 +560,10 @@ static int nci_close_device(struct nci_d */ mutex_lock(&ndev->req_lock); + if (test_and_set_bit(NCI_UNREG +1, &ndev->flags)) { + mutex_unlock(&ndev->req_lock); + return 0; + } if (!test_and_clear_bit(NCI_UP, &ndev->flags)) { /* Need to flush the cmd wq in case * there is a queued/running cmd_work @@ -601,6 +605,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); --