Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i2c: tiny-usb: disable zero-length read messages

This driver passes the length of an i2c_msg directly to
usb_control_msg(). If the message is now a read and of length 0, it
violates the USB protocol and a warning will be printed. Enable the
I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length
read messages altogether.

Fixes: e8c76eed2ecd ("i2c: New i2c-tiny-usb bus driver")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: <stable@vger.kernel.org> # v2.6.22+
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250522064349.3823-2-wsa+renesas@sang-engineering.com

authored by

Wolfram Sang and committed by
Andi Shyti
cbdb25cc 56ad91c1

+6
+6
drivers/i2c/busses/i2c-tiny-usb.c
··· 139 139 return ret; 140 140 } 141 141 142 + /* prevent invalid 0-length usb_control_msg */ 143 + static const struct i2c_adapter_quirks usb_quirks = { 144 + .flags = I2C_AQ_NO_ZERO_LEN_READ, 145 + }; 146 + 142 147 /* This is the actual algorithm we define */ 143 148 static const struct i2c_algorithm usb_algorithm = { 144 149 .xfer = usb_xfer, ··· 252 247 /* setup i2c adapter description */ 253 248 dev->adapter.owner = THIS_MODULE; 254 249 dev->adapter.class = I2C_CLASS_HWMON; 250 + dev->adapter.quirks = &usb_quirks; 255 251 dev->adapter.algo = &usb_algorithm; 256 252 dev->adapter.algo_data = dev; 257 253 snprintf(dev->adapter.name, sizeof(dev->adapter.name),