Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp}
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 6 Apr 2023 16:33:09 +0000 (09:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:35:06 +0000 (12:35 +0200)
commit348d446762e7c70778df8bafbdf3fa0df2123f58
tree3fe4df3ad144f6d98eb0990442c131237029ca8c
parent71964e93fcb19222750b6930f9623ca14fb2a06d
Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp}

commit a2a9339e1c9deb7e1e079e12e27a0265aea8421a upstream.

Similar to commit d0be8347c623 ("Bluetooth: L2CAP: Fix use-after-free
caused by l2cap_chan_put"), just use l2cap_chan_hold_unless_zero to
prevent referencing a channel that is about to be destroyed.

Cc: stable@kernel.org
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Min Li <lm0963hack@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/bluetooth/l2cap_core.c