]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tipc: avoid use-after-free in poll trace queue dumps
authorZihan Xi <zihanx@nebusec.ai>
Thu, 23 Jul 2026 16:38:41 +0000 (00:38 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 27 Jul 2026 22:18:59 +0000 (15:18 -0700)
TIPC socket tracepoints dump queue state through tipc_sk_dump(). Most
queue-dump callsites already serialize that walk under the socket lock or
sk->sk_lock.slock, but tipc_poll() calls trace_tipc_sk_poll(...,
TIPC_DUMP_ALL, ...) without holding either lock.

That lets the poll trace path reach tipc_list_dump() and backlog head/tail
dumping while another context dequeues and frees an skb, leaving the trace
helper dereferencing a stale queue entry.

Stop the unlocked poll trace site from requesting queue dumps. Other queue
dump trace callsites keep their existing output under the locking they
already provide, while poll still emits the event itself without walking
live queue members from an unlocked context.

Fixes: b4b9771bcbbd ("tipc: enable tracepoints in tipc")
Cc: stable@vger.kernel.org
Reported-by: Vega <vega@nebusec.ai>
Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
Signed-off-by: Ren Wei <enjou1224z@gmail.com>
Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Link: https://patch.msgid.link/f8119abd5e5ecc400597de667ae9d39656de56d0.1784794294.git.zihanx@nebusec.ai
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/tipc/socket.c

index 185c24003b822a03c317a55f2d462446a86015df..d5d70eb230b56a761be26f3a573081d029fa4445 100644 (file)
@@ -796,7 +796,7 @@ static __poll_t tipc_poll(struct file *file, struct socket *sock,
        __poll_t revents = 0;
 
        sock_poll_wait(file, sock, wait);
-       trace_tipc_sk_poll(sk, NULL, TIPC_DUMP_ALL, " ");
+       trace_tipc_sk_poll(sk, NULL, TIPC_DUMP_NONE, " ");
 
        if (sk->sk_shutdown & RCV_SHUTDOWN)
                revents |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;