Patch "bpf: tcp: Use sock_gen_put instead of sock_put in bpf_iter_tcp" has been added to the 5.15-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

    bpf: tcp: Use sock_gen_put instead of sock_put in bpf_iter_tcp

to the 5.15-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:
     bpf-tcp-use-sock_gen_put-instead-of-sock_put-in-bpf_.patch
and it can be found in the queue-5.15 subdirectory.

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



commit fe4164618d58c5853b10a90f8fb57f78c05beb71
Author: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
Date:   Mon Mar 27 17:42:32 2023 -0700

    bpf: tcp: Use sock_gen_put instead of sock_put in bpf_iter_tcp
    
    [ Upstream commit 580031ff9952b7dbf48dedba6b56a100ae002bef ]
    
    While reviewing the udp-iter batching patches, noticed the bpf_iter_tcp
    calling sock_put() is incorrect. It should call sock_gen_put instead
    because bpf_iter_tcp is iterating the ehash table which has the req sk
    and tw sk. This patch replaces all sock_put with sock_gen_put in the
    bpf_iter_tcp codepath.
    
    Fixes: 04c7820b776f ("bpf: tcp: Bpf iter batching and lock_sock")
    Signed-off-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20230328004232.2134233-1-martin.lau@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0e1fbad17dbe3..63472c9b39ae4 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2760,7 +2760,7 @@ static int tcp_prog_seq_show(struct bpf_prog *prog, struct bpf_iter_meta *meta,
 static void bpf_iter_tcp_put_batch(struct bpf_tcp_iter_state *iter)
 {
 	while (iter->cur_sk < iter->end_sk)
-		sock_put(iter->batch[iter->cur_sk++]);
+		sock_gen_put(iter->batch[iter->cur_sk++]);
 }
 
 static int bpf_iter_tcp_realloc_batch(struct bpf_tcp_iter_state *iter,
@@ -2919,7 +2919,7 @@ static void *bpf_iter_tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 		 * st->bucket.  See tcp_seek_last_pos().
 		 */
 		st->offset++;
-		sock_put(iter->batch[iter->cur_sk++]);
+		sock_gen_put(iter->batch[iter->cur_sk++]);
 	}
 
 	if (iter->cur_sk < iter->end_sk)



[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