]> git.ipfire.org Git - thirdparty/linux.git/commit
Bluetooth: btmtk: Fix short read errors in btmtk_usb_reg_read()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jul 2026 15:57:33 +0000 (17:57 +0200)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 28 Jul 2026 20:13:48 +0000 (16:13 -0400)
commit0cc4b5649ae83deb8222100dba31aa0f100a19cd
tree57ef1b9feb40bbc7a0227879511394ed7daefb13
parentb186c18c4843dd58adc29443369bddc71cb626a3
Bluetooth: btmtk: Fix short read errors in btmtk_usb_reg_read()

If btmtk_usb_reg_read() gets a "short" read from a device, it will
accidentally treat that as a "real" read and populate the returned value
with some unknown and probably totally invalid data.

Fix this logic error up by calling usb_control_msg_recv() which
guarantees a "full" read happens, and then simplify the error checking
for when btmtk_usb_reg_read() is called (it's really just
btmtk_usb_id_get() that calls btmtk_usb_reg_read(), so fix up those
return sites.

Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btmtk.c