projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b5a2a8e
)
usb: core: buffer: avoid NULL pointer dereferrence
author
Chunfeng Yun
<chunfeng.yun@mediatek.com>
Thu, 28 Apr 2016 03:42:20 +0000
(11:42 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 28 Apr 2016 19:35:36 +0000
(12:35 -0700)
NULL pointer dereferrence will happen when class driver
wants to allocate zero length buffer and pool_max[0]
can't be used, so simply returns NULL in the case.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/buffer.c
patch
|
blob
|
history
diff --git
a/drivers/usb/core/buffer.c
b/drivers/usb/core/buffer.c
index 2741566ee4f25849e64d8c61ce9064a534b56647..98e39f91723a52ec7cf607dc60f50035e66a569f 100644
(file)
--- a/
drivers/usb/core/buffer.c
+++ b/
drivers/usb/core/buffer.c
@@
-122,6
+122,9
@@
void *hcd_buffer_alloc(
struct usb_hcd *hcd = bus_to_hcd(bus);
int i;
+ if (size == 0)
+ return NULL;
+
/* some USB hosts just use PIO */
if (!IS_ENABLED(CONFIG_HAS_DMA) ||
(!bus->controller->dma_mask &&