mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
855a28f9c9
When a driver returns -EOPNOTSUPP in dsa_port_bridge_join() but failed
to provide a reason for it, DSA attempts to set the extack to say that
software fallback will kick in.
The problem is, when we use brctl and the legacy bridge ioctls, the
extack will be NULL, and DSA dereferences it in the process of setting
it.
Sergei Antonov proves this using the following stack trace:
Unable to handle kernel NULL pointer dereference at virtual address 00000000
PC is at dsa_slave_changeupper+0x5c/0x158
dsa_slave_changeupper from raw_notifier_call_chain+0x38/0x6c
raw_notifier_call_chain from __netdev_upper_dev_link+0x198/0x3b4
__netdev_upper_dev_link from netdev_master_upper_dev_link+0x50/0x78
netdev_master_upper_dev_link from br_add_if+0x430/0x7f4
br_add_if from br_ioctl_stub+0x170/0x530
br_ioctl_stub from br_ioctl_call+0x54/0x7c
br_ioctl_call from dev_ifsioc+0x4e0/0x6bc
dev_ifsioc from dev_ioctl+0x2f8/0x758
dev_ioctl from sock_ioctl+0x5f0/0x674
sock_ioctl from sys_ioctl+0x518/0xe40
sys_ioctl from ret_fast_syscall+0x0/0x1c
Fix the problem by only overriding the extack if non-NULL.
Fixes:
|
||
---|---|---|
.. | ||
dsa2.c | ||
dsa_priv.h | ||
dsa.c | ||
Kconfig | ||
Makefile | ||
master.c | ||
port.c | ||
slave.c | ||
switch.c | ||
tag_8021q.c | ||
tag_ar9331.c | ||
tag_brcm.c | ||
tag_dsa.c | ||
tag_gswip.c | ||
tag_hellcreek.c | ||
tag_ksz.c | ||
tag_lan9303.c | ||
tag_mtk.c | ||
tag_ocelot_8021q.c | ||
tag_ocelot.c | ||
tag_qca.c | ||
tag_rtl4_a.c | ||
tag_rtl8_4.c | ||
tag_rzn1_a5psw.c | ||
tag_sja1105.c | ||
tag_trailer.c | ||
tag_xrs700x.c |