Commit 81af6290 authored by Edward AD's avatar Edward AD Committed by sanglipeng
Browse files

Bluetooth: hci_sock: fix slab oob read in create_monitor_event

stable inclusion
from stable-v5.10.199
commit b423509bc99c7c7a7e31d0daa858bca9c45e5f54
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9AWJ5

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b423509bc99c7c7a7e31d0daa858bca9c45e5f54



--------------------------------

commit 18f547f3 upstream.

When accessing hdev->name, the actual string length should prevail

Reported-by: default avatar <syzbot+c90849c50ed209d77689@syzkaller.appspotmail.com>
Fixes: dcda1657 ("Bluetooth: hci_core: Fix build warnings")
Signed-off-by: default avatarEdward AD <twuufnxlz@gmail.com>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 0dbf594a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -438,7 +438,7 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event)
		ni->type = hdev->dev_type;
		ni->bus = hdev->bus;
		bacpy(&ni->bdaddr, &hdev->bdaddr);
		memcpy(ni->name, hdev->name, 8);
		memcpy(ni->name, hdev->name, strlen(hdev->name));

		opcode = cpu_to_le16(HCI_MON_NEW_INDEX);
		break;