Patch "vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()" has been added to the 4.19-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 4.19-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-4.19 subdirectory.

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



commit c31da294e92c36305029e0312db351bfda60f1c5
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 449b5261e6610..187d0f7253a6f 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -348,7 +348,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