Bluetooth: L2CAP: Fix possible multiple reject send
authorFrédéric Danis <frederic.danis@collabora.com>
Tue, 19 Dec 2023 08:10:22 +0000 (09:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Feb 2024 20:14:25 +0000 (20:14 +0000)
commit100089a1ec709731d2fbb4c2d823c5eb339bed59
treecfb4267a1b4bd00ef3faf9bea996e6455c4d8707
parente266b7b2d4b5902caaa2f1da73754fee09a894e2
Bluetooth: L2CAP: Fix possible multiple reject send

[ Upstream commit 96a3398b467ab8aada3df2f3a79f4b7835d068b8 ]

In case of an incomplete command or a command with a null identifier 2
reject packets will be sent, one with the identifier and one with 0.
Consuming the data of the command will prevent it.
This allows to send a reject packet for each corrupted command in a
multi-command packet.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/l2cap_core.c