USB: serial: keyspan: fix missing indat transfer sanity check

Add the missing sanity check on the size of usa49wg indat transfers to
avoid parsing stale or uninitialised slab data.

Fixes: 0ca1268e10 ("USB Serial Keyspan: add support for USA-49WG & USA-28XG")
Cc: stable@vger.kernel.org	# 2.6.23
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
Johan Hovold 2026-05-20 16:26:48 +02:00
parent cb3560e8ea
commit ab8336a7e4

View File

@ -1187,6 +1187,10 @@ static void usa49wg_indat_callback(struct urb *urb)
len = 0;
while (i < urb->actual_length) {
if (urb->actual_length - i < 3) {
dev_warn_ratelimited(&urb->dev->dev, "malformed indat packet\n");
break;
}
/* Check port number from message */
if (data[i] >= serial->num_ports) {