FAILED: patch "[PATCH] Bluetooth: MGMT: validate Add Extended Advertising Data" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x d3f7d17960ed50df3a6709c5158caff989c8c905
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026052818-tattered-watch-83b6@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d3f7d17960ed50df3a6709c5158caff989c8c905 Mon Sep 17 00:00:00 2001
From: Michael Bommarito <[email protected]>
Date: Fri, 15 May 2026 10:38:19 -0400
Subject: [PATCH] Bluetooth: MGMT: validate Add Extended Advertising Data
length
MGMT_OP_ADD_EXT_ADV_DATA is registered as a variable-length command, with MGMT_ADD_EXT_ADV_DATA_SIZE as the fixed header size. The handler then uses cp->adv_data_len and cp->scan_rsp_len to validate and copy cp->data, but it never checks that those bytes are part of the mgmt command payload.
A short command can therefore make add_ext_adv_data() pass an out-of-bounds pointer into tlv_data_is_valid(). If the bytes beyond the command buffer are addressable, they can also be copied into the advertising instance as scan response data, where the caller can read them back via MGMT_OP_GET_ADV_INSTANCE. The trigger requires CAP_NET_ADMIN in the initial user namespace; KASAN reports an 8-byte slab-out-of-bounds read.
Reject commands whose length does not match the fixed header plus both advertising data lengths before parsing cp->data.
net/bluetooth/mgmt.c +6 -0
@@ -9110,9 +9110,15 @@ static int add_ext_adv_data(struct sock *sk, struct hci_dev *hdev, void *data,struct adv_info *adv_instance;int err =0 ;struct mgmt_pending_cmd *cmd; +u16 expected_len;BT_DBG ("%s" , hdev->name); + expected_len =struct_size (cp, data, cp->adv_data_len + cp->scan_rsp_len); +if (expected_len != data_len) +return mgmt_cmd_status (sk, hdev->id,MGMT_OP_ADD_EXT_ADV_DATA , +MGMT_STATUS_INVALID_PARAMS ); +hci_dev_lock (hdev); adv_instance =hci_find_adv_instance (hdev, cp->instance);