From mboxrd@z Thu Jan 1 00:00:00 1970 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 D06F32C6B7; Fri, 5 Jan 2024 14:39:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="O8TJ9n5N" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59467C433C8; Fri, 5 Jan 2024 14:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1704465579; bh=cdr8QrJtYV8G861iAAQJmsdoPKUDNCYwPeUt7C7z5pQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O8TJ9n5N0X13RPGePg4BbKyH6ygmdlB1vOkgy00eTJqXyb965bJ1kOuA194zRQDPG 5MxCX2jdGyhcmwTjOnj+3R9ZGUYTiFoVIVNcmGyC5O+RoH5UXzbhGuji2MwurGPW4F xQ1VYjU4N24j1xBBCdtEOYJv+Owe+hPbC8AP0+d4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Luiz Augusto von Dentz Subject: [PATCH 4.14 17/21] Bluetooth: hci_event: Fix not checking if HCI_OP_INQUIRY has been sent Date: Fri, 5 Jan 2024 15:39:04 +0100 Message-ID: <20240105143812.318041033@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240105143811.536282337@linuxfoundation.org> References: <20240105143811.536282337@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luiz Augusto von Dentz commit 99e67d46e5ff3c7c901af6009edec72d3d363be8 upstream. Before setting HCI_INQUIRY bit check if HCI_OP_INQUIRY was really sent otherwise the controller maybe be generating invalid events or, more likely, it is a result of fuzzing tools attempting to test the right behavior of the stack when unexpected events are generated. Cc: stable@vger.kernel.org Link: https://bugzilla.kernel.org/show_bug.cgi?id=218151 Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/hci_event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -1471,7 +1471,8 @@ static void hci_cs_inquiry(struct hci_de return; } - set_bit(HCI_INQUIRY, &hdev->flags); + if (hci_sent_cmd_data(hdev, HCI_OP_INQUIRY)) + set_bit(HCI_INQUIRY, &hdev->flags); } static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)