mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 01:32:21 +02:00
USB: serial: io_edgeport: cap received transmit credits
The interrupt-status packet reports transmit credits returned by the
device. edge_interrupt_callback() adds the 16-bit value to txCredits
without checking maxTxCredits.
edge_write() uses txCredits minus the software FIFO count as the amount
of data that fits. Since the FIFO is allocated with maxTxCredits bytes,
txCredits exceeding maxTxCredits can cause OOB write in ring buffer.
Cap accumulated credits at maxTxCredits. Conforming devices should never
hit the cap.
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Assisted-by: Codex:GPT-5
Signed-off-by: Sunho Park <shpark061104@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
parent
55645e4f3c
commit
faaddd811c
|
|
@ -646,7 +646,8 @@ static void edge_interrupt_callback(struct urb *urb)
|
|||
if (edge_port && edge_port->open) {
|
||||
spin_lock_irqsave(&edge_port->ep_lock,
|
||||
flags);
|
||||
edge_port->txCredits += txCredits;
|
||||
edge_port->txCredits = min(edge_port->txCredits + txCredits,
|
||||
edge_port->maxTxCredits);
|
||||
spin_unlock_irqrestore(&edge_port->ep_lock,
|
||||
flags);
|
||||
dev_dbg(dev, "%s - txcredits for port%d = %d\n",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user