android_kernel_motorola_sm6375/drivers/net
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ziyang Xuan c5f6478686 team: fix null-ptr-deref when team device type is changed
[ Upstream commit 492032760127251e5540a5716a70996bacf2a3fd ]

Get a null-ptr-deref bug as follows with reproducer [1].

BUG: kernel NULL pointer dereference, address: 0000000000000228
...
RIP: 0010:vlan_dev_hard_header+0x35/0x140 [8021q]
...
Call Trace:
 <TASK>
 ? __die+0x24/0x70
 ? page_fault_oops+0x82/0x150
 ? exc_page_fault+0x69/0x150
 ? asm_exc_page_fault+0x26/0x30
 ? vlan_dev_hard_header+0x35/0x140 [8021q]
 ? vlan_dev_hard_header+0x8e/0x140 [8021q]
 neigh_connected_output+0xb2/0x100
 ip6_finish_output2+0x1cb/0x520
 ? nf_hook_slow+0x43/0xc0
 ? ip6_mtu+0x46/0x80
 ip6_finish_output+0x2a/0xb0
 mld_sendpack+0x18f/0x250
 mld_ifc_work+0x39/0x160
 process_one_work+0x1e6/0x3f0
 worker_thread+0x4d/0x2f0
 ? __pfx_worker_thread+0x10/0x10
 kthread+0xe5/0x120
 ? __pfx_kthread+0x10/0x10
 ret_from_fork+0x34/0x50
 ? __pfx_kthread+0x10/0x10
 ret_from_fork_asm+0x1b/0x30

[1]
$ teamd -t team0 -d -c '{"runner": {"name": "loadbalance"}}'
$ ip link add name t-dummy type dummy
$ ip link add link t-dummy name t-dummy.100 type vlan id 100
$ ip link add name t-nlmon type nlmon
$ ip link set t-nlmon master team0
$ ip link set t-nlmon nomaster
$ ip link set t-dummy up
$ ip link set team0 up
$ ip link set t-dummy.100 down
$ ip link set t-dummy.100 master team0

When enslave a vlan device to team device and team device type is changed
from non-ether to ether, header_ops of team device is changed to
vlan_header_ops. That is incorrect and will trigger null-ptr-deref
for vlan->real_dev in vlan_dev_hard_header() because team device is not
a vlan device.

Cache eth_header_ops in team_setup(), then assign cached header_ops to
header_ops of team net device when its type is changed from non-ether
to ether to fix the bug.

Fixes: 1d76efe157 ("team: add support for non-ethernet devices")
Suggested-by: Hangbin Liu <[email protected]>
Reviewed-by: Hangbin Liu <[email protected]>
Signed-off-by: Ziyang Xuan <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2023-10-10 21:46:37 +02:00
..
appletalk
arcnet net: arcnet: Do not call kfree_skb() under local_irq_disable() 2023-09-23 10:59:43 +02:00
bonding bonding: fix macvlan over alb bond support 2023-08-30 16:27:24 +02:00
caif
can can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM 2023-09-23 10:59:41 +02:00
dsa net: dsa: mv88e6xxx: Wait for EEPROM done before HW reset 2023-08-30 16:27:17 +02:00
ethernet net: hns3: add 5ms delay before clear firmware reset irq source 2023-10-10 21:46:37 +02:00
fddi
fjes
hamradio
hippi
hyperv
ieee802154 ieee802154: hwsim: Fix possible memory leaks 2023-06-28 10:18:38 +02:00
ipvlan ipvlan: Fix a reference count leak warning in ipvlan_ns_exit() 2023-08-30 16:27:23 +02:00
netdevsim
phy net: phy: broadcom: stub c45 read/write for 54810 2023-08-30 16:27:20 +02:00
plip
ppp
slip
team team: fix null-ptr-deref when team device type is changed 2023-10-10 21:46:37 +02:00
usb r8152: check budget for r8152_poll() 2023-09-23 11:00:01 +02:00
vmxnet3
wan net: lapbether: only support ethernet devices 2023-06-21 15:44:12 +02:00
wimax
wireless wifi: mac80211_hwsim: drop short frames 2023-09-23 11:00:03 +02:00
xen-netback xen/netback: Fix buffer overrun triggered by unusual packet 2023-08-08 19:56:37 +02:00
dummy.c
eql.c
geneve.c
gtp.c gtp: Fix use-after-free in __gtp_encap_destroy(). 2023-07-27 08:37:11 +02:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c Revert "net: macsec: preserve ingress frame ordering" 2023-09-23 10:59:40 +02:00
macvlan.c
macvtap.c
Makefile
mdio.c
mii.c
net_failover.c net/net_failover: fix txq exceeding warning 2023-04-05 11:16:44 +02:00
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c net: tap_open(): set sk_uid from current_fsuid() 2023-08-11 11:53:59 +02:00
thunderbolt.c
tun.c drivers: net: prevent tun_build_skb() to exceed the packet size limit 2023-08-16 18:19:24 +02:00
veth.c veth: Fixing transmit return status for dropped packets 2023-09-23 10:59:58 +02:00
virtio_net.c virtio-net: set queues after driver_ok 2023-08-30 16:27:19 +02:00
vrf.c
vsockmon.c
vxlan.c vxlan: generalize vxlan_parse_gpe_hdr and remove unused args 2023-09-23 10:59:38 +02:00
xen-netfront.c