mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-16 05:50:19 +00:00
USB: pl2303: enforce baud-rate limits before lookup
Enforce any baud-rate limits before doing table lookup. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
59afe10e8d
commit
871996ede1
@ -351,6 +351,9 @@ static void pl2303_encode_baud_rate(struct tty_struct *tty,
|
|||||||
dev_dbg(&port->dev, "baud requested = %u\n", baud);
|
dev_dbg(&port->dev, "baud requested = %u\n", baud);
|
||||||
if (!baud)
|
if (!baud)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (spriv->type->max_baud_rate)
|
||||||
|
baud = min_t(speed_t, baud, spriv->type->max_baud_rate);
|
||||||
/*
|
/*
|
||||||
* Set baud rate to nearest supported value.
|
* Set baud rate to nearest supported value.
|
||||||
*
|
*
|
||||||
@ -359,9 +362,6 @@ static void pl2303_encode_baud_rate(struct tty_struct *tty,
|
|||||||
*/
|
*/
|
||||||
baud = pl2303_get_supported_baud_rate(baud);
|
baud = pl2303_get_supported_baud_rate(baud);
|
||||||
|
|
||||||
if (spriv->type->max_baud_rate)
|
|
||||||
baud = min_t(speed_t, baud, spriv->type->max_baud_rate);
|
|
||||||
|
|
||||||
if (baud <= 115200) {
|
if (baud <= 115200) {
|
||||||
put_unaligned_le32(baud, buf);
|
put_unaligned_le32(baud, buf);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user