linux-kernelorg-stable/net/tipc
Haixia Qu f82727adcf tipc: fix null-ptr-deref when acquiring remote ip of ethernet bearer
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>
2025-06-18 14:19:50 -07:00
..
Kconfig
Makefile
addr.c
addr.h
bcast.c net: tipc: avoid possible garbage value 2024-09-13 20:03:43 -07:00
bcast.h
bearer.c net/tipc: replace deprecated strcpy with strscpy 2024-08-29 12:33:14 -07:00
bearer.h
core.c
core.h
crypto.c net: tipc: fix refcount warning in tipc_aead_encrypt 2025-05-29 12:07:26 +02:00
crypto.h
diag.c
discover.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
discover.h
eth_media.c
group.c
group.h
ib_media.c
link.c tipc: Removing deprecated strncpy() 2025-04-15 13:37:14 +02:00
link.h
monitor.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
monitor.h
msg.c
msg.h
name_distr.c
name_distr.h
name_table.c net: tipc: remove one synchronize_net() from tipc_nametbl_stop() 2024-12-06 17:41:28 -08:00
name_table.h net: tipc: remove one synchronize_net() from tipc_nametbl_stop() 2024-12-06 17:41:28 -08:00
net.c
net.h
netlink.c
netlink.h
netlink_compat.c
node.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
node.h
socket.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
socket.h
subscr.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
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-18 14:19:50 -07:00
udp_media.h