Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD83AC433F5 for ; Tue, 16 Nov 2021 14:00:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D2E561BF5 for ; Tue, 16 Nov 2021 14:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236905AbhKPODC (ORCPT ); Tue, 16 Nov 2021 09:03:02 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:44643 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236943AbhKPOC6 (ORCPT ); Tue, 16 Nov 2021 09:02:58 -0500 Received: from smtpclient.apple (p4fefc15c.dip0.t-ipconnect.de [79.239.193.92]) by mail.holtmann.org (Postfix) with ESMTPSA id EB77ECECD7; Tue, 16 Nov 2021 14:59:57 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\)) Subject: Re: [PATCH v3] Bluetooth: Don't initialize msft/aosp when using user channel From: Marcel Holtmann In-Reply-To: <20211115220021.v3.1.I2a8b2f2e52d05ae9ead3f3dcc1dd90ef47a7acd7@changeid> Date: Tue, 16 Nov 2021 14:59:57 +0100 Cc: linux-bluetooth , Abhishek Pandit-Subedi , Sonny Sasaka , "David S. Miller" , Jakub Kicinski , Johan Hedberg , Luiz Augusto von Dentz , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <20211115220021.v3.1.I2a8b2f2e52d05ae9ead3f3dcc1dd90ef47a7acd7@changeid> To: Jesse Melhuish X-Mailer: Apple Mail (2.3693.20.0.1.32) Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Jesse, > A race condition is triggered when usermode control is given to > userspace before the kernel's MSFT query responds, resulting in an > unexpected response to userspace's reset command. > > Issue can be observed in btmon: > < HCI Command: Vendor (0x3f|0x001e) plen 2 #3 [hci0] > 05 01 .. > @ USER Open: bt_stack_manage (privileged) version 2.22 {0x0002} [hci0] > < HCI Command: Reset (0x03|0x0003) plen 0 #4 [hci0] >> HCI Event: Command Complete (0x0e) plen 5 #5 [hci0] > Vendor (0x3f|0x001e) ncmd 1 > Status: Command Disallowed (0x0c) > 05 . >> HCI Event: Command Complete (0x0e) plen 4 #6 [hci0] > Reset (0x03|0x0003) ncmd 2 > Status: Success (0x00) > Reviewed-by: Abhishek Pandit-Subedi > Reviewed-by: Sonny Sasaka > Signed-off-by: Jesse Melhuish > --- > > Changes in v3: > - Added guard around *_close calls as well. > > Changes in v2: > - Moved guard to the new home for this code. > > net/bluetooth/hci_sync.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel