Am Mittwoch, den 07.03.2018, 13:41 -0800 schrieb sathyanarayananIn that case do you think we should use some WARN_ON() for invalid index in usb_serial_generic_read_bulk_callback()?
kuppuswamy :
On 03/07/2018 12:58 PM, Greg KH wrote:If this happens the function was called for a stray URB.
So I don't see why your check is needed, what other code path would evervoid usb_serial_generic_read_bulk_callback(struct urb *urb)
call this function in a way that the bounds check would be needed?
385ÂÂÂÂÂÂÂÂ for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) {
386ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (urb == port->read_urbs[i])
387ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ break;
388ÂÂÂÂÂÂÂÂ }
In here, after this for loop is done (without any matching urb), i value
will be equal to ARRAY_SIZE(port->read_urbs). So there is a possibility
of usb_serial_generic_submit_read_urb() getting called with this invalid
index.
Your check comes to late. We have called set_bit with an invalid index
and other shit.
We definitely do not just want to return an error in that case.
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html