Skip to content

Commit 64b687f

Browse files
shpark1104gregkh
authored andcommitted
USB: serial: io_edgeport: cap received transmit credits
commit faaddd8 upstream. 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: 1da177e ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 24506a4 commit 64b687f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/usb/serial/io_edgeport.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ static void edge_interrupt_callback(struct urb *urb)
646646
if (edge_port && edge_port->open) {
647647
spin_lock_irqsave(&edge_port->ep_lock,
648648
flags);
649-
edge_port->txCredits += txCredits;
649+
edge_port->txCredits = min(edge_port->txCredits + txCredits,
650+
edge_port->maxTxCredits);
650651
spin_unlock_irqrestore(&edge_port->ep_lock,
651652
flags);
652653
dev_dbg(dev, "%s - txcredits for port%d = %d\n",

0 commit comments

Comments
 (0)