[PATCH 4/6] USB: serial: ftdi_sio: only allow valid event_char values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <abbotti@xxxxxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux