Patch "vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     vsock-virtio-fix-unsigned-integer-wrap-around-in-vir.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3b4c3b487e3d7f804d2fb5ba090c80c72c90b820
Author: Nikolay Kuratov <kniv@xxxxxxxxxxxxxx>
Date:   Mon Dec 11 19:23:17 2023 +0300

    vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()
    
    [ Upstream commit 60316d7f10b17a7ebb1ead0642fee8710e1560e0 ]
    
    We need to do signed arithmetic if we expect condition
    `if (bytes < 0)` to be possible
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE
    
    Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko")
    Signed-off-by: Nikolay Kuratov <kniv@xxxxxxxxxxxxxx>
    Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231211162317.4116625-1-kniv@xxxxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index c9ee9259af48a..080e8f2bf9855 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -436,7 +436,7 @@ static s64 virtio_transport_has_space(struct vsock_sock *vsk)
 	struct virtio_vsock_sock *vvs = vsk->trans;
 	s64 bytes;
 
-	bytes = vvs->peer_buf_alloc - (vvs->tx_cnt - vvs->peer_fwd_cnt);
+	bytes = (s64)vvs->peer_buf_alloc - (vvs->tx_cnt - vvs->peer_fwd_cnt);
 	if (bytes < 0)
 		bytes = 0;
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux