summaryrefslogtreecommitdiff
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorAlan <gnomes@lxorguk.ukuu.org.uk>2016-02-15 19:09:46 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-21 04:15:57 (GMT)
commit3c724888d2b1e085cd45343dee5f233aec705439 (patch)
tree9ee72b54c823162edfe0f0b5cbbe107532d9c190 /drivers/usb/chipidea
parent0ca10122ca08d21e375b8c85bd7b498b1aeaf55d (diff)
downloadlinux-3c724888d2b1e085cd45343dee5f233aec705439.tar.xz
chipidea: error on overflow for port_test_write
The write value is 8bit, but currently writing a larger number (eg a doubled digit) is not errored but instead gets cast and sets off an action probably undesired. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/debug.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
index de5c509..6d23eed 100644
--- a/drivers/usb/chipidea/debug.c
+++ b/drivers/usb/chipidea/debug.c
@@ -100,6 +100,9 @@ static ssize_t ci_port_test_write(struct file *file, const char __user *ubuf,
if (sscanf(buf, "%u", &mode) != 1)
return -EINVAL;
+ if (mode > 255)
+ return -EBADRQC;
+
pm_runtime_get_sync(ci->dev);
spin_lock_irqsave(&ci->lock, flags);
ret = hw_port_test_set(ci, mode);