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 F360F21ABC1; Tue, 29 Apr 2025 17:47:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745948847; cv=none; b=F9JdopjxQxAQWjPebcJLZmcFtP9sXDSILEiL5MzRm5jug/0B7VWtaoy3bKuxfe/I5EYpN+62MB9d5tVOwePPrsB0x0kRBjH6CcQwOeaggFXPE3EEw07AvQquswDwxkzIf8IJ8F1DEa420gPwrJ11JRsK/XyTV1rqwF9zzpNRf4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745948847; c=relaxed/simple; bh=0QAjXPaIYr7rFFgHPwB9t5NFtgrK5aW0KwWnx6QIIME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dAl3cC6702asTIsZ/JAAe3Pdg6e7MoO+EFGDNLIDPHBeBppQiRf7TPahLWcUjjgbjabAhaYeG+usgfHk7ja7gTUnEZdsH2na9PYuR1x6UJoFz8X8Vezo0/kx5bfXjv1adwux9mwcnCsU3wz5GUkja+jSQIPIOjCcUQ+VhbfU1CQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=thzv+z5h; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="thzv+z5h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 849C8C4CEE3; Tue, 29 Apr 2025 17:47:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745948846; bh=0QAjXPaIYr7rFFgHPwB9t5NFtgrK5aW0KwWnx6QIIME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=thzv+z5h8nyQgE3JvJLy6dZSOZx0lgbFrCdy1PjCMsX6kOIjaLr6dTW5ItOBx4OFR CiWfsp6Azo9snL0Y3L67Cqa1ZEEYoSSxbZT9E3IL6O7adzcQ3gbf3XtPUkuRpiw9sz T8KZqhC1fAZp7pZ53kgXkUW9uQZGu4eQmcMvDTwQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.15 136/373] Bluetooth: hci_event: Fix sending MGMT_EV_DEVICE_FOUND for invalid address Date: Tue, 29 Apr 2025 18:40:13 +0200 Message-ID: <20250429161128.759646464@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250429161123.119104857@linuxfoundation.org> References: <20250429161123.119104857@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luiz Augusto von Dentz [ Upstream commit eb73b5a9157221f405b4fe32751da84ee46b7a25 ] This fixes sending MGMT_EV_DEVICE_FOUND for invalid address (00:00:00:00:00:00) which is a regression introduced by a2ec905d1e16 ("Bluetooth: fix kernel oops in store_pending_adv_report") since in the attempt to skip storing data for extended advertisement it actually made the code to skip the entire if statement supposed to send MGMT_EV_DEVICE_FOUND without attempting to use the last_addr_adv which is garanteed to be invalid for extended advertisement since we never store anything on it. Link: https://github.com/bluez/bluez/issues/1157 Link: https://github.com/bluez/bluez/issues/1149#issuecomment-2767215658 Fixes: a2ec905d1e16 ("Bluetooth: fix kernel oops in store_pending_adv_report") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_event.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 83af50c3838a9..84b07b27b3cf4 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5777,11 +5777,12 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr, * event or send an immediate device found event if the data * should not be stored for later. */ - if (!ext_adv && !has_pending_adv_report(hdev)) { + if (!has_pending_adv_report(hdev)) { /* If the report will trigger a SCAN_REQ store it for * later merging. */ - if (type == LE_ADV_IND || type == LE_ADV_SCAN_IND) { + if (!ext_adv && (type == LE_ADV_IND || + type == LE_ADV_SCAN_IND)) { store_pending_adv_report(hdev, bdaddr, bdaddr_type, rssi, flags, data, len); return; -- 2.39.5