Skip to content

Commit 7447629

Browse files
author
Desnes Nunes
committed
usbip: Fix seqnum sign extension issue in vhci_tx_urb
JIRA: https://issues.redhat.com/browse/RHEL-78931 commit 15b93f3 Author: Xiong Nandi <xndchn@gmail.com> Date: Wed, 1 Jan 2025 00:15:37 +0800 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> Signed-off-by: Desnes Nunes <desnesn@redhat.com>
1 parent 97c813e commit 7447629

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/usbip/vhci_hcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev)
676676

677677
spin_lock_irqsave(&vdev->priv_lock, flags);
678678

679-
priv->seqnum = atomic_inc_return(&vhci_hcd->seqnum);
679+
priv->seqnum = (u32)atomic_inc_return(&vhci_hcd->seqnum);
680680
if (priv->seqnum == 0xffff)
681681
dev_info(&urb->dev->dev, "seqnum max\n");
682682

0 commit comments

Comments
 (0)