The "event_char" device attribute value, when written, is interpreted as
an enable bit in bit 8, and an "event character" in bits 7 to 0.  Return
an error for out-of-range values.

Signed-off-by: Ian Abbott <abbo...@mev.co.uk>
---
 drivers/usb/serial/ftdi_sio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 2da99875cecb..2662fc3b49c5 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1738,6 +1738,9 @@ static ssize_t store_event_char(struct device *dev,
        int v = simple_strtoul(valbuf, NULL, 10);
        int rv;
 
+       if (v < 0 || v >= 0x200)
+               return -EINVAL;
+
        dev_dbg(&port->dev, "%s: setting event char = %i\n", __func__, v);
 
        rv = usb_control_msg(udev,
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to