]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf, sockmap: Account for receive queue in FIONREAD without a verdict program
authorMattia Meleleo <mattia.meleleo@coralogix.com>
Wed, 8 Jul 2026 16:55:00 +0000 (18:55 +0200)
committerKumar Kartikeya Dwivedi <memxor@gmail.com>
Wed, 15 Jul 2026 09:10:14 +0000 (11:10 +0200)
commit04af4efde58a4a4ef4feab7360c46af9ec0b83a0
tree69e256ce558f4a30bab3598ff343beef259a4b39
parent71836d063d2d97d5b66f9c2477c2d8035558a6fc
bpf, sockmap: Account for receive queue in FIONREAD without a verdict program

tcp_bpf_ioctl() answers SIOCINQ from psock->msg_tot_len, which only
counts bytes in ingress_msg. Without a stream/skb verdict program
nothing is diverted there: data stays in sk_receive_queue, so FIONREAD
returns 0 even though read() returns data.

Add tcp_inq() to the reported value when the psock has no verdict
program. The two queues are disjoint, so bytes redirected into
ingress_msg from other sockets stay correctly accounted through
msg_tot_len.

Remove unused sk_psock_msg_inq().

Fixes: 929e30f93125 ("bpf, sockmap: Fix FIONREAD for sockmap")
Signed-off-by: Mattia Meleleo <mattia.meleleo@coralogix.com>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20260708-fionread-no-verdict-v3-1-b4ee31b3af53@coralogix.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
include/linux/skmsg.h
net/ipv4/tcp_bpf.c