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

usb: gadget: gr_udc: Fix check for invalid number of microframes

The value 0x3 (not 0x11) in the field for additional transaction/microframe
is reserved and should not be let through. Be clear in the error message about
what value caused the error return.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Andreas Larsson and committed by
Felipe Balbi
6ee96cc0 7adb5c87

+3 -2
+3 -2
drivers/usb/gadget/gr_udc.c
··· 1532 1532 "%s mode: multiple trans./microframe not valid\n", 1533 1533 (mode == 2 ? "Bulk" : "Control")); 1534 1534 return -EINVAL; 1535 - } else if (nt == 0x11) { 1536 - dev_err(dev->dev, "Invalid value for trans./microframe\n"); 1535 + } else if (nt == 0x3) { 1536 + dev_err(dev->dev, 1537 + "Invalid value 0x3 for additional trans./microframe\n"); 1537 1538 return -EINVAL; 1538 1539 } else if ((nt + 1) * max > buffer_size) { 1539 1540 dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n",