Patch "selftests/bpf: Check length of recv in test_sockmap" has been added to the 5.4-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

    selftests/bpf: Check length of recv in test_sockmap

to the 5.4-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:
     selftests-bpf-check-length-of-recv-in-test_sockmap.patch
and it can be found in the queue-5.4 subdirectory.

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



commit 97b41f50b784bbe65204b63830902ffc2d5638a1
Author: Geliang Tang <geliang@xxxxxxxxxx>
Date:   Thu May 23 14:50:03 2024 +0800

    selftests/bpf: Check length of recv in test_sockmap
    
    [ Upstream commit de1b5ea789dc28066cc8dc634b6825bd6148f38b ]
    
    The value of recv in msg_loop may be negative, like EWOULDBLOCK, so it's
    necessary to check if it is positive before accumulating it to bytes_recvd.
    
    Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
    Signed-off-by: Geliang Tang <tanggeliang@xxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Tested-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>
    Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>
    Link: https://lore.kernel.org/bpf/5172563f7c7b2a2e953cef02e89fc34664a7b190.1716446893.git.tanggeliang@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index 779e11da979c8..5e5648ed0b11f 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -552,7 +552,8 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
 				}
 			}
 
-			s->bytes_recvd += recv;
+			if (recv > 0)
+				s->bytes_recvd += recv;
 
 			if (data) {
 				int chunk_sz = opt->sendpage ?




[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