Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7856730rdb; Thu, 4 Jan 2024 09:41:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzzx8Mc9v/mrny6LnfU/xu+HpPAD/6pqoOpGIVJ7pDRZW8Rnt+Oqz1/be9bArFfutYvN3x X-Received: by 2002:a05:6e02:1a87:b0:35d:689b:de92 with SMTP id k7-20020a056e021a8700b0035d689bde92mr1087871ilv.18.1704390104388; Thu, 04 Jan 2024 09:41:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704390104; cv=none; d=google.com; s=arc-20160816; b=fpgI8o4NMrPoKaDLRcmfe2HvqZSJulifspX0i4cimRT2U2f8j24xlqZNN38e6mD9O+ NPsYFYxlXvsj9WOE6pqNFcAhS2k10xcSauSkHxBapUi8b7ebTB7RRwaglFRxekQaThYP GYiRpPW/K0c+hBTdmwnb3tMfIhNvLTcgaaKdTp8td7De0ZGnWRxe9zFSx0LbxvFpGUys Xe6g/+InuBQUApKohOEi4BnvF9D1avFNogDiShBiXQSlJkcmirxUDvf9CuiC0rurNkO1 tcKlVOHSeqpnrTzvdU4DZ82dfFDwbjrHd4Gq/F2bAIIEdQ0NUl8PL2eEllSVmgSGhMEM hD+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KDTg93Ffemu208mknOs4sUhaeFQdW7728m1qwteOaKA=; fh=kHHCX+kML/5ayqBxdUYjZTB9qph9zvbaVeLgBdGZeQ8=; b=vj3FEABBAIpP44dtWI6ZRNuaiiPaBDPP5mgTZrRrp69SvxSZSQErMoS3WwC3Yt0bqf Mjw/BhmahFoEZSDNk/ibcWYv2xdYBI3zFgLZcm4an4CR0BdS4bu8O5erVOK6MwVOzXOg 5rGfT6kh0a04oogMmPCybBKxXEnYpWVPXtAbKjdP6Dgt6V6iWku9GFyu7v+RJFceEceT f0SGrqMl653N5bdSYvC4cpsKOF8lMCy9DI54qamAtFsjxMiLm1ITR+ixLCS1gZvI7qGo Ag4QjtrF1PNyDNqXD15MCFnbsvl2k1WA+78t3mQLHfXkI2Hs+7Q9B2s4eaS5mSIPIlSt rGlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q5xFB4NA; spf=pass (google.com: domain of linux-kernel+bounces-17049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id v12-20020a63480c000000b005cd98385b07si24119109pga.223.2024.01.04.09.41.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:41:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q5xFB4NA; spf=pass (google.com: domain of linux-kernel+bounces-17049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 09B8B2856AD for ; Thu, 4 Jan 2024 17:41:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C27F528DCA; Thu, 4 Jan 2024 17:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q5xFB4NA" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EDDD828DC9; Thu, 4 Jan 2024 17:41:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB67DC433C7; Thu, 4 Jan 2024 17:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704390076; bh=45gUpzqYT6iNQEcLOob1vr6Fx8e/AyvPgBn5FFKgBoM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q5xFB4NABx9s0keDcrEtsKWLEBxJLYOZyEwFZ393rVuN22lGMLAzGU5dY5zUddHq8 2UC47UhIo6b3EfaP2QEC/4lcUZW4/Wz6hZbiWjgkqtNeKPN05sgvW4QfTKlN5udI18 yty1n6jfDEsxS2ua/meUChGIn8nmELmnLW0NEmXZHmrKBh1wsRVV34/CHmLGf6wIxY 2yJUPAAjawcMExQaev7Qs3Fg09LCBuOuACE+5rWBAulFSGzNKy9zOv9wIhiCEX3F3+ obDUNGKn5+yVREjzPPUkhy0eU84PV7dMtfJlWqSr9069ugWlvdQs23LY3uNikorsGb pyPV6go7mMsQQ== Date: Thu, 4 Jan 2024 17:41:12 +0000 From: Simon Horman To: Jonas =?utf-8?Q?Dre=C3=9Fler?= Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] Bluetooth: hci_sync: Check the correct flag before starting a scan Message-ID: <20240104174112.GJ31813@kernel.org> References: <20240102180810.54515-1-verdre@v0yd.nl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240102180810.54515-1-verdre@v0yd.nl> On Tue, Jan 02, 2024 at 07:08:08PM +0100, Jonas Dreßler wrote: > There's a very confusing mistake in the code starting a HCI inquiry: We're > calling hci_dev_test_flag() to test for HCI_INQUIRY, but hci_dev_test_flag() > checks hdev->dev_flags instead of hdev->flags. HCI_INQUIRY is a bit that's > set on hdev->flags, not on hdev->dev_flags though. > > HCI_INQUIRY equals the integer 7, and in hdev->dev_flags, 7 means > HCI_BONDABLE, so we were actually checking for HCI_BONDABLE here. > > The mistake is only present in the synchronous code for starting an inquiry, > not in the async one. Also devices are typically bondable while doing an > inquiry, so that might be the reason why nobody noticed it so far. > > Signed-off-by: Jonas Dreßler FWIIW, I agree with this analysis and the proposed fix looks correct to me. Reviewed-by: Simon Horman I do wonder if it is appropriate to treat this as a bug fix - is there a use-visible problem? If so, the following seems appropriate to me. Fixes: abfeea476c68 ("Bluetooth: hci_sync: Convert MGMT_OP_START_DISCOVERY") ...