]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Bluetooth: btusb: revert use of devm_kzalloc in btusb
authorRaphael Pinsonneault-Thibeault <rpthibeault@gmail.com>
Wed, 10 Dec 2025 16:02:28 +0000 (11:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:56 +0000 (13:09 +0100)
commitfff9206b0907252a41eb12b7c1407b9347df18b1
treeb44b864e193ab47a0bbcfce40647f84d8008673a
parentbaf0e2d1e03ddb04781dfe7f22a654d3611f69b2
Bluetooth: btusb: revert use of devm_kzalloc in btusb

[ Upstream commit 252714f1e8bdd542025b16321c790458014d6880 ]

This reverts commit 98921dbd00c4e ("Bluetooth: Use devm_kzalloc in
btusb.c file").

In btusb_probe(), we use devm_kzalloc() to allocate the btusb data. This
ties the lifetime of all the btusb data to the binding of a driver to
one interface, INTF. In a driver that binds to other interfaces, ISOC
and DIAG, this is an accident waiting to happen.

The issue is revealed in btusb_disconnect(), where calling
usb_driver_release_interface(&btusb_driver, data->intf) will have devm
free the data that is also being used by the other interfaces of the
driver that may not be released yet.

To fix this, revert the use of devm and go back to freeing memory
explicitly.

Fixes: 98921dbd00c4e ("Bluetooth: Use devm_kzalloc in btusb.c file")
Signed-off-by: Raphael Pinsonneault-Thibeault <rpthibeault@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/bluetooth/btusb.c