USB: check usb_get_extra_descriptor for proper size
When reading an extra descriptor, we need to properly check the minimum and maximum size allowed, to prevent from invalid data being sent by a device. Reported-by: Hui Peng <benquike@gmail.com> Reported-by: Mathias Payer <mathias.payer@nebelwelt.net> Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Hui Peng <benquike@gmail.com> Signed-off-by: Mathias Payer <mathias.payer@nebelwelt.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
2f2dde6ba8
commit
704620afc7
@@ -407,11 +407,11 @@ struct usb_host_bos {
|
||||
};
|
||||
|
||||
int __usb_get_extra_descriptor(char *buffer, unsigned size,
|
||||
unsigned char type, void **ptr);
|
||||
unsigned char type, void **ptr, size_t min);
|
||||
#define usb_get_extra_descriptor(ifpoint, type, ptr) \
|
||||
__usb_get_extra_descriptor((ifpoint)->extra, \
|
||||
(ifpoint)->extralen, \
|
||||
type, (void **)ptr)
|
||||
type, (void **)ptr, sizeof(**(ptr)))
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
Reference in New Issue
Block a user