usb: gadget: f_fs: Assorted buffer overflow checks.
authorVincent Pelletier <plr.vincent@gmail.com>
Wed, 18 Jan 2017 00:57:44 +0000 (00:57 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Jan 2017 11:03:52 +0000 (12:03 +0100)
commit83e526f2a2fa4b2e82b6bd3ddbb26b70acfa8947
tree3067a6dfefc8299039bc89f9eca8dc36a77e1ab4
parentd9b2997e4a0a874e452df7cdd7de5a54502bd0aa
usb: gadget: f_fs: Assorted buffer overflow checks.

OS descriptor head, when flagged as provided, is accessed without
checking if it fits in provided buffer. Verify length before access.
Also, there are other places where buffer length it checked
after accessing offsets which are potentially past the end. Check
buffer length before as well to fail cleanly.

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_fs.c