Patch "samples/bpf: Fix buffer overflow in tcp_basertt" 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

    samples/bpf: Fix buffer overflow in tcp_basertt

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:
     samples-bpf-fix-buffer-overflow-in-tcp_basertt.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 0ee82b960f4dc01a0d320e8313ba5f9117652bcd
Author: Pengcheng Yang <yangpc@xxxxxxxxxx>
Date:   Fri May 5 16:50:58 2023 +0800

    samples/bpf: Fix buffer overflow in tcp_basertt
    
    [ Upstream commit f4dea9689c5fea3d07170c2cb0703e216f1a0922 ]
    
    Using sizeof(nv) or strlen(nv)+1 is correct.
    
    Fixes: c890063e4404 ("bpf: sample BPF_SOCKET_OPS_BASE_RTT program")
    Signed-off-by: Pengcheng Yang <yangpc@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/1683276658-2860-1-git-send-email-yangpc@xxxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/samples/bpf/tcp_basertt_kern.c b/samples/bpf/tcp_basertt_kern.c
index 9dba48c2b9207..66dd58f78d528 100644
--- a/samples/bpf/tcp_basertt_kern.c
+++ b/samples/bpf/tcp_basertt_kern.c
@@ -47,7 +47,7 @@ int bpf_basertt(struct bpf_sock_ops *skops)
 		case BPF_SOCK_OPS_BASE_RTT:
 			n = bpf_getsockopt(skops, SOL_TCP, TCP_CONGESTION,
 					   cong, sizeof(cong));
-			if (!n && !__builtin_memcmp(cong, nv, sizeof(nv)+1)) {
+			if (!n && !__builtin_memcmp(cong, nv, sizeof(nv))) {
 				/* Set base_rtt to 80us */
 				rv = 80;
 			} else if (n) {



[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