Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp462837rdb; Mon, 15 Jan 2024 03:09:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIlXQRjg8cvkPKpKldV2jNxR44ekbWHK6aSVtQ7FidL4cyibM+JBPJN4lU1835wSL5cuss X-Received: by 2002:a92:c942:0:b0:35f:e9c4:7051 with SMTP id i2-20020a92c942000000b0035fe9c47051mr7147695ilq.95.1705316963379; Mon, 15 Jan 2024 03:09:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705316963; cv=none; d=google.com; s=arc-20160816; b=uxx7OS9MwwElk2FsCoWUBXDZueTOI8wzOhGtM+IgqyP0wxsc2Pc+iilt+2Dhjby/zw nsMHtYRDTM8rgVMZCr8PpprLmIAWEtiqy3+kkh690WaHBnnicHoMgCDVjXLCcyzX/5rh sjxSuf2okuU1fWkeJ4SqC5U5BvY+rvpMuYNbZKo0z0DaW1KuRDlYw+gZ6lrwpvkyiYO3 iRkyFrNDkG3Ci78Gu+OsVDXq5zkTzwRKA/Y95l0cJD4LYcpLEStJJWiKS7LQRxOVV1/Y A86AOTfpRdLg00n5NPMwEMua6Su2mUQZQz1GpTdIWGXgsjgfJ1YVjvXt2aEJcZsypqEs Udmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=I7O+/JArvc9sliP/UikapSmIL3BpW59i/2zdvVA58lI=; fh=95wfaGvvAnH7C3R30h9vreDi5V8YZWnZYhXDOGn6b9E=; b=Y9/YBtxe5o91F1yzl+EwpWVQ6zX6nnnywJDHWCmPfwMDDJilzsAkGh2FCglNqokZBg jqwIcGNZWIYTbAKa/ceQ6koqAb2j2q2PbfJzEN+A5Qo9R2SSFdH8HQj/czMRVYfeZ83M XgDM3CyK/FML7PsctVGzbC/WTundUxxYVno6vZ3yKbmkQThc2UrplSwfjQvGMq/SN0Qr RglWTX7HDWs37tapQkqXmaBHwLB7CiTR3dWrU8QrbznTKHvUn4xILr/PdYNa8Y9Z2N1o q1HqMGwfZ5rDnWMPc/yJzoBzeYNZMCu3Q6wWqdsSBr4vAxUmk1gbwW+oz0KvppuhyAo/ pG2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25915-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q18-20020a656852000000b005b8ef498e2bsi8957786pgt.461.2024.01.15.03.09.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 03:09:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25915-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C0F05B215F5 for ; Mon, 15 Jan 2024 11:09:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA350282D6; Mon, 15 Jan 2024 11:09:11 +0000 (UTC) Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (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 AF9851E867 for ; Mon, 15 Jan 2024 11:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=I-love.SAKURA.ne.jp Received: from fsav111.sakura.ne.jp (fsav111.sakura.ne.jp [27.133.134.238]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 40FB91nb026996; Mon, 15 Jan 2024 20:09:01 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav111.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav111.sakura.ne.jp); Mon, 15 Jan 2024 20:09:01 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav111.sakura.ne.jp) Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 40FB90l7026993 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Mon, 15 Jan 2024 20:09:00 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <199a52ed-59d0-4651-b361-3b3d0692a2bf@I-love.SAKURA.ne.jp> Date: Mon, 15 Jan 2024 20:08:58 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] nfc/nci: fix task hung in nfc_targets_found Content-Language: en-US To: Krzysztof Kozlowski , Edward Adam Davis , syzbot+2b131f51bb4af224ab40@syzkaller.appspotmail.com Cc: davem@davemloft.net, edumazet@google.com, gregkh@linuxfoundation.org, hdanton@sina.com, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, stern@rowland.harvard.edu, syzkaller-bugs@googlegroups.com, torvalds@linux-foundation.org References: <000000000000a041b0060eb045ec@google.com> <10fa514a-7fa0-449f-a7fd-cd3bfb0180d7@linaro.org> From: Tetsuo Handa In-Reply-To: <10fa514a-7fa0-449f-a7fd-cd3bfb0180d7@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2024/01/15 18:36, Krzysztof Kozlowski wrote: >> diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c >> index 6c9592d05120..9a277228a875 100644 >> --- a/net/nfc/nci/core.c >> +++ b/net/nfc/nci/core.c >> @@ -145,6 +145,8 @@ inline int nci_request(struct nci_dev *ndev, >> { >> int rc; >> >> + if (test_bit(NCI_UNREG, &ndev->flags)) >> + return -ENODEV; > > nci_close_device() clears the NCI_UP, which is tested here, just after > acquiring mutex. And there is explicit comment about it just below your > code. Why it is not relevant? Because the deadlock happens at mutex_lock(&ndev->req_lock), which is before test_bit(NCI_UP, &ndev->flags) is called. Please see https://lkml.kernel.org/r/d314e471-0251-461e-988d-70add0c6ebf6@I-love.SAKURA.ne.jp . > > Your code looks really unnecessary, at least with that code flow from > commit msg. Especially considering you do it outside of mutex, so how > does it solve anything? > > Best regards, > Krzysztof >