aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/usb/host/uhci-q.c
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-01-23 16:13:41 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-24 13:42:09 -0800
commit13996ca7afd5b5d7980ea013b00e3ef7cf2cefd0 (patch)
tree5819c68b358a7c9fe44eee44b5e884e1bfe335ea /drivers/usb/host/uhci-q.c
parentUSB: Set usb port's DeviceRemovable according acpi information (diff)
downloadwireguard-linux-13996ca7afd5b5d7980ea013b00e3ef7cf2cefd0.tar.xz
wireguard-linux-13996ca7afd5b5d7980ea013b00e3ef7cf2cefd0.zip
USB: uhci: check buffer length to avoid memory overflow
for function uhci_sprint_schedule: the buffer len is MAX_OUTPUT: 64 * 1024, which may not be enough: may loop UHCI_NUMFRAMES times (UHCI_NUMFRAMES is 1024) each time of loop may get more than 64 bytes so need check the buffer length to avoid memory overflow this patch fix it like this: at first, make enough room for buffering the exceeding contents judge the contents which written whether bigger than buffer length if bigger (the exceeding contents will be in the exceeding buffer) break current work flow, and return. Signed-off-by: Chen Gang <gang.chen@asianux.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/uhci-q.c')
-rw-r--r--drivers/usb/host/uhci-q.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 15921fd55048..f0976d8190bc 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -1200,7 +1200,7 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
if (debug > 1 && errbuf) {
/* Print the chain for debugging */
uhci_show_qh(uhci, urbp->qh, errbuf,
- ERRBUF_LEN, 0);
+ ERRBUF_LEN - EXTRA_SPACE, 0);
lprintk(errbuf);
}
}