[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6bb3b80b-a808-4992-8666-535ed9a5c980@rowland.harvard.edu>
Date: Tue, 25 Mar 2025 13:47:15 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
syzbot <syzbot+c38e5e60d0041a99dbf5@...kaller.appspotmail.com>,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, syzkaller-bugs@...glegroups.com,
linux-i2c@...r.kernel.org
Subject: Re: [syzbot] [usb?] WARNING in dib0700_i2c_xfer/usb_submit_urb
On Tue, Mar 25, 2025 at 05:59:10PM +0100, Wolfram Sang wrote:
>
> > > > As far as I can tell from the source code, the dib0700 simply isn't able
> > > > to handle 0-length reads. Should the dib0700_ctrl_rd() routine be
> > > > changed simply to return 0 in such cases?
> > >
> > > The adapter (I assume the one in dvb-usb-i2c.c) should populate an
> > > i2c_adapter_quirks struct with I2C_AQ_NO_ZERO_LEN and then the core will
> > > bail out for you.
> >
> > Or the I2C_AQ_NO_ZERO_LEN_READ flag bit.
>
> Yes, that would be more convervative. Does USB allow zero-length writes?
It does.
> > What about all the other fields in the i2c_adapter_quirks structure?
> > How should they be set? (Note: I don't know anything about this driver
> > or these devices; I'm just chasing down the syzbot bug report.)
>
> As I also don't know the hardware, I suggest to leave them empty. 0
> means "no quirk".
Okay, let's see if this works.
Alan Stern
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5fc319360819
Index: usb-devel/drivers/media/usb/dvb-usb/dvb-usb-i2c.c
===================================================================
--- usb-devel.orig/drivers/media/usb/dvb-usb/dvb-usb-i2c.c
+++ usb-devel/drivers/media/usb/dvb-usb/dvb-usb-i2c.c
@@ -10,6 +10,9 @@
int dvb_usb_i2c_init(struct dvb_usb_device *d)
{
+ static const struct i2c_adapter_quirks i2c_usb_quirks = {
+ .flags = I2C_AQ_NO_ZERO_LEN_READ,
+ };
int ret = 0;
if (!(d->props.caps & DVB_USB_IS_AN_I2C_ADAPTER))
@@ -24,6 +27,7 @@ int dvb_usb_i2c_init(struct dvb_usb_devi
strscpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name));
d->i2c_adap.algo = d->props.i2c_algo;
d->i2c_adap.algo_data = NULL;
+ d->i2c_adap.quirks = &i2c_usb_quirks;
d->i2c_adap.dev.parent = &d->udev->dev;
i2c_set_adapdata(&d->i2c_adap, d);
Powered by blists - more mailing lists