]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: add timeout sanity check to hci_inquiry
authorPavel Skripkin <paskripkin@gmail.com>
Thu, 19 Aug 2021 15:15:21 +0000 (18:15 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 07:47:35 +0000 (09:47 +0200)
commit8185b2d30f9921bd5423e2aa812f114077487765
tree82aa2ce12413936c2264e7cedecd231b692fecf4
parent2c56a04e208708cb0dc1a64388bf251f6294bb9e
Bluetooth: add timeout sanity check to hci_inquiry

[ Upstream commit f41a4b2b5eb7872109723dab8ae1603bdd9d9ec1 ]

Syzbot hit "task hung" bug in hci_req_sync(). The problem was in
unreasonable huge inquiry timeout passed from userspace.
Fix it by adding sanity check for timeout value to hci_inquiry().

Since hci_inquiry() is the only user of hci_req_sync() with user
controlled timeout value, it makes sense to check timeout value in
hci_inquiry() and don't touch hci_req_sync().

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-and-tested-by: syzbot+be2baed593ea56c6a84c@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_core.c