linux-yocto/net/tipc
Haixia Qu d3dfe821df tipc: fix null-ptr-deref when acquiring remote ip of ethernet bearer
[ Upstream commit f82727adcf ]

The reproduction steps:
1. create a tun interface
2. enable l2 bearer
3. TIPC_NL_UDP_GET_REMOTEIP with media name set to tun

tipc: Started in network mode
tipc: Node identity 8af312d38a21, cluster identity 4711
tipc: Enabled bearer <eth:syz_tun>, priority 1
Oops: general protection fault
KASAN: null-ptr-deref in range
CPU: 1 UID: 1000 PID: 559 Comm: poc Not tainted 6.16.0-rc1+ #117 PREEMPT
Hardware name: QEMU Ubuntu 24.04 PC
RIP: 0010:tipc_udp_nl_dump_remoteip+0x4a4/0x8f0

the ub was in fact a struct dev.

when bid != 0 && skip_cnt != 0, bearer_list[bid] may be NULL or
other media when other thread changes it.

fix this by checking media_id.

Fixes: 832629ca5c ("tipc: add UDP remoteip dump to netlink API")
Signed-off-by: Haixia Qu <hxqu@hillstonenet.com>
Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Link: https://patch.msgid.link/20250617055624.2680-1-hxqu@hillstonenet.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:09:02 +01:00
..
addr.c
addr.h
bcast.c
bcast.h
bearer.c
bearer.h
core.c
core.h
crypto.c tipc: use kfree_sensitive() for aead cleanup 2025-06-27 11:08:52 +01:00
crypto.h
diag.c sock_diag: add module pointer to "struct sock_diag_handler" 2024-12-09 10:32:09 +01:00
discover.c
discover.h
eth_media.c
group.c
group.h
ib_media.c
Kconfig
link.c tipc: fix memory leak in tipc_link_xmit 2025-04-25 10:45:06 +02:00
link.h
Makefile
monitor.c tipc: fix NULL pointer dereference in tipc_mon_reinit_self() 2025-05-02 07:50:43 +02:00
monitor.h
msg.c
msg.h
name_distr.c
name_distr.h
name_table.c
name_table.h
net.c
net.h
netlink_compat.c
netlink.c
netlink.h
node.c
node.h
socket.c
socket.h
subscr.c
subscr.h
sysctl.c
topsrv.c
topsrv.h
trace.c
trace.h
udp_media.c tipc: fix null-ptr-deref when acquiring remote ip of ethernet bearer 2025-06-27 11:09:02 +01:00
udp_media.h