| From e8200f1d755da044c3b37f813b8edffd98cc6c43 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Thu, 22 May 2025 10:09:54 +0200 |
| Subject: media: usb: hdpvr: disable zero-length read messages |
| |
| From: Wolfram Sang <wsa+renesas@sang-engineering.com> |
| |
| [ Upstream commit b5ae5a79825ba8037b0be3ef677a24de8c063abf ] |
| |
| 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. |
| |
| Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> |
| Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/media/usb/hdpvr/hdpvr-i2c.c | 6 ++++++ |
| 1 file changed, 6 insertions(+) |
| |
| diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c |
| index 070559b01b01..54956a8ff15e 100644 |
| --- a/drivers/media/usb/hdpvr/hdpvr-i2c.c |
| +++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c |
| @@ -165,10 +165,16 @@ static const struct i2c_algorithm hdpvr_algo = { |
| .functionality = hdpvr_functionality, |
| }; |
| |
| +/* prevent invalid 0-length usb_control_msg */ |
| +static const struct i2c_adapter_quirks hdpvr_quirks = { |
| + .flags = I2C_AQ_NO_ZERO_LEN_READ, |
| +}; |
| + |
| static const struct i2c_adapter hdpvr_i2c_adapter_template = { |
| .name = "Hauppauge HD PVR I2C", |
| .owner = THIS_MODULE, |
| .algo = &hdpvr_algo, |
| + .quirks = &hdpvr_quirks, |
| }; |
| |
| static int hdpvr_activate_ir(struct hdpvr_device *dev) |
| -- |
| 2.39.5 |
| |