Commit 52a843f2 authored by Ruihan Li's avatar Ruihan Li Committed by openeuler-sync-bot
Browse files

bluetooth: Add cmd validity checks at the start of hci_sock_ioctl()

stable inclusion
from stable-v5.10.182
commit e4d2e6c3054b974125bdae74ee57017964232c4a
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8GJZJ

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



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

commit 000c2fa2 upstream.

Previously, channel open messages were always sent to monitors on the first
ioctl() call for unbound HCI sockets, even if the command and arguments
were completely invalid. This can leave an exploitable hole with the abuse
of invalid ioctl calls.

This commit hardens the ioctl processing logic by first checking if the
command is valid, and immediately returning with an ENOIOCTLCMD error code
if it is not. This ensures that ioctl calls with invalid commands are free
of side effects, and increases the difficulty of further exploitation by
forcing exploitation to find a way to pass a valid command first.

Signed-off-by: default avatarRuihan Li <lrh2000@pku.edu.cn>
Co-developed-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: default avatarDragos-Marian Panait <dragos.panait@windriver.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
(cherry picked from commit 954393f1)
parent c63a6a53
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment