Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usbip: Fix seqnum sign extension issue in vhci_tx_urb

The atomic_inc_return function returns an int, while priv->seqnum is an
unsigned long. So we must cast the result to u32 to prevent potential
sign extension and size mismatch issues.

Signed-off-by: Xiong Nandi <xndchn@gmail.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20241231161539.20192-2-xndchn@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xiong Nandi and committed by
Greg Kroah-Hartman
15b93f34 6d7965fb

+1 -1
+1 -1
drivers/usb/usbip/vhci_hcd.c
··· 676 676 677 677 spin_lock_irqsave(&vdev->priv_lock, flags); 678 678 679 - priv->seqnum = atomic_inc_return(&vhci_hcd->seqnum); 679 + priv->seqnum = (u32)atomic_inc_return(&vhci_hcd->seqnum); 680 680 if (priv->seqnum == 0xffff) 681 681 dev_info(&urb->dev->dev, "seqnum max\n"); 682 682