YueHaibing
33902b4a42
netdevsim: Fix error handling in nsim_fib_init and nsim_fib_exit
In nsim_fib_init(), if register_fib_notifier failed, nsim_fib_net_ops
should be unregistered before return.
In nsim_fib_exit(), unregister_fib_notifier should be called before
nsim_fib_net_ops be unregistered, otherwise may cause use-after-free:
BUG: KASAN: use-after-free in nsim_fib_event_nb+0x342/0x570 [netdevsim]
Read of size 8 at addr ffff8881daaf4388 by task kworker/0:3/3499
CPU: 0 PID: 3499 Comm: kworker/0:3 Not tainted 5.3.0-rc7+ #30
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
Workqueue: ipv6_addrconf addrconf_dad_work [ipv6]
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xa9/0x10e lib/dump_stack.c:113
print_address_description+0x65/0x380 mm/kasan/report.c:351
__kasan_report+0x149/0x18d mm/kasan/report.c:482
kasan_report+0xe/0x20 mm/kasan/common.c:618
nsim_fib_event_nb+0x342/0x570 [netdevsim]
notifier_call_chain+0x52/0xf0 kernel/notifier.c:95
__atomic_notifier_call_chain+0x78/0x140 kernel/notifier.c:185
call_fib_notifiers+0x30/0x60 net/core/fib_notifier.c:30
call_fib6_entry_notifiers+0xc1/0x100 [ipv6]
fib6_add+0x92e/0x1b10 [ipv6]
__ip6_ins_rt+0x40/0x60 [ipv6]
ip6_ins_rt+0x84/0xb0 [ipv6]
__ipv6_ifa_notify+0x4b6/0x550 [ipv6]
ipv6_ifa_notify+0xa5/0x180 [ipv6]
addrconf_dad_completed+0xca/0x640 [ipv6]
addrconf_dad_work+0x296/0x960 [ipv6]
process_one_work+0x5c0/0xc00 kernel/workqueue.c:2269
worker_thread+0x5c/0x670 kernel/workqueue.c:2415
kthread+0x1d7/0x200 kernel/kthread.c:255
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352
Allocated by task 3388:
save_stack+0x19/0x80 mm/kasan/common.c:69
set_track mm/kasan/common.c:77 [inline]
__kasan_kmalloc.constprop.3+0xa0/0xd0 mm/kasan/common.c:493
kmalloc include/linux/slab.h:557 [inline]
kzalloc include/linux/slab.h:748 [inline]
ops_init+0xa9/0x220 net/core/net_namespace.c:127
__register_pernet_operations net/core/net_namespace.c:1135 [inline]
register_pernet_operations+0x1d4/0x420 net/core/net_namespace.c:1212
register_pernet_subsys+0x24/0x40 net/core/net_namespace.c:1253
nsim_fib_init+0x12/0x70 [netdevsim]
veth_get_link_ksettings+0x2b/0x50 [veth]
do_one_initcall+0xd4/0x454 init/main.c:939
do_init_module+0xe0/0x330 kernel/module.c:3490
load_module+0x3c2f/0x4620 kernel/module.c:3841
__do_sys_finit_module+0x163/0x190 kernel/module.c:3931
do_syscall_64+0x72/0x2e0 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 3534:
save_stack+0x19/0x80 mm/kasan/common.c:69
set_track mm/kasan/common.c:77 [inline]
__kasan_slab_free+0x130/0x180 mm/kasan/common.c:455
slab_free_hook mm/slub.c:1423 [inline]
slab_free_freelist_hook mm/slub.c:1474 [inline]
slab_free mm/slub.c:3016 [inline]
kfree+0xe9/0x2d0 mm/slub.c:3957
ops_free net/core/net_namespace.c:151 [inline]
ops_free_list.part.7+0x156/0x220 net/core/net_namespace.c:184
ops_free_list net/core/net_namespace.c:182 [inline]
__unregister_pernet_operations net/core/net_namespace.c:1165 [inline]
unregister_pernet_operations+0x221/0x2a0 net/core/net_namespace.c:1224
unregister_pernet_subsys+0x1d/0x30 net/core/net_namespace.c:1271
nsim_fib_exit+0x11/0x20 [netdevsim]
nsim_module_exit+0x16/0x21 [netdevsim]
__do_sys_delete_module kernel/module.c:1015 [inline]
__se_sys_delete_module kernel/module.c:958 [inline]
__x64_sys_delete_module+0x244/0x330 kernel/module.c:958
do_syscall_64+0x72/0x2e0 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Reported-by: Hulk Robot <[email protected]>
Fixes: 59c84b9fcf ("netdevsim: Restore per-network namespace accounting for fib entries")
Signed-off-by: YueHaibing <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
2019-10-13 11:30:14 -07:00 |
| .. |
|
accessibility
|
|
|
|
acpi
|
Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
|
2019-09-28 08:14:15 -07:00 |
|
amba
|
ARM updates for 5.4-rc1:
|
2019-09-22 09:39:09 -07:00 |
|
android
|
|
|
|
ata
|
ata: libahci_platform: Add of_node_put() before loop exit
|
2019-09-19 12:21:44 -06:00 |
|
atm
|
atm: he: clean up an indentation issue
|
2019-09-25 13:54:45 +02:00 |
|
auxdisplay
|
It's a somewhat calmer cycle for docs this time, as the churn of the mass
|
2019-09-17 16:22:26 -07:00 |
|
base
|
mm,thp: stats for file backed THP
|
2019-09-24 15:54:11 -07:00 |
|
bcma
|
bcma: make arrays pwr_info_offset and sprom_sizes static const, shrinks object size
|
2019-09-13 16:44:49 +03:00 |
|
block
|
for-linus-2019-10-03
|
2019-10-04 09:56:51 -07:00 |
|
bluetooth
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
|
2019-09-15 14:17:27 +02:00 |
|
bus
|
ARM: SoC fixes
|
2019-09-30 10:04:28 -07:00 |
|
cdrom
|
|
|
|
char
|
char/random: Add a newline at the end of the file
|
2019-10-02 13:49:43 -07:00 |
|
clk
|
ARM SCMI fixes for v5.4
|
2019-09-29 11:20:41 -07:00 |
|
clocksource
|
timer-of: don't use conditional expression with mixed 'void' types
|
2019-10-02 16:16:07 -07:00 |
|
connector
|
|
|
|
counter
|
|
|
|
cpufreq
|
Power management updates for 5.4-rc1
|
2019-09-17 19:15:14 -07:00 |
|
cpuidle
|
Power management updates for 5.4-rc1
|
2019-09-17 19:15:14 -07:00 |
|
crypto
|
Merge branch 'akpm' (patches from Andrew)
|
2019-09-24 16:10:23 -07:00 |
|
dax
|
|
|
|
dca
|
|
|
|
devfreq
|
|
|
|
dio
|
|
|
|
dma
|
Main MIPS changes for v5.4:
|
2019-09-22 09:30:30 -07:00 |
|
dma-buf
|
|
|
|
edac
|
ARM updates for 5.4-rc1:
|
2019-09-22 09:39:09 -07:00 |
|
eisa
|
|
|
|
extcon
|
chrome platform changes for v5.4
|
2019-09-19 14:14:28 -07:00 |
|
firewire
|
|
|
|
firmware
|
ARM: SoC fixes
|
2019-09-30 10:04:28 -07:00 |
|
fpga
|
Char/Misc driver patches for 5.4-rc1
|
2019-09-18 11:14:31 -07:00 |
|
fsi
|
|
|
|
gnss
|
|
|
|
gpio
|
pwm: Changes for v5.4-rc1
|
2019-09-27 12:19:47 -07:00 |
|
gpu
|
- Fix DP-MST crtc_mask
|
2019-10-04 16:31:06 +10:00 |
|
greybus
|
|
|
|
hid
|
- First round of vmbus hibernation support from Dexuan Cui.
|
2019-09-24 12:36:31 -07:00 |
|
hsi
|
HSI changes for the 5.4 series
|
2019-09-22 12:02:21 -07:00 |
|
hv
|
- First round of vmbus hibernation support from Dexuan Cui.
|
2019-09-24 12:36:31 -07:00 |
|
hwmon
|
ARM SCMI fixes for v5.4
|
2019-09-29 11:20:41 -07:00 |
|
hwspinlock
|
|
|
|
hwtracing
|
Char/Misc driver patches for 5.4-rc1
|
2019-09-18 11:14:31 -07:00 |
|
i2c
|
i2c: slave-eeprom: Add read only mode
|
2019-09-28 20:44:12 +02:00 |
|
i3c
|
|
|
|
ide
|
|
|
|
idle
|
|
|
|
iio
|
chrome platform changes for v5.4
|
2019-09-19 14:14:28 -07:00 |
|
infiniband
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
|
2019-09-28 17:47:33 -07:00 |
|
input
|
chrome platform changes for v5.4
|
2019-09-19 14:14:28 -07:00 |
|
interconnect
|
|
|
|
iommu
|
IOMMU Fixes for Linux v5.4-rc1
|
2019-09-29 10:00:14 -07:00 |
|
ipack
|
|
|
|
irqchip
|
Main MIPS changes for v5.4:
|
2019-09-22 09:30:30 -07:00 |
|
isdn
|
mISDN: enforce CAP_NET_RAW for raw sockets
|
2019-09-24 16:37:18 +02:00 |
|
leds
|
leds: lm3532: Fix optional led-max-microamp prop error handling
|
2019-09-12 20:45:52 +02:00 |
|
lightnvm
|
|
|
|
macintosh
|
|
|
|
mailbox
|
mailbox: qcom-apcs: fix max_register value
|
2019-09-17 00:54:29 -05:00 |
|
mcb
|
|
|
|
md
|
for-5.4/post-2019-09-24
|
2019-09-24 16:31:50 -07:00 |
|
media
|
media/v4l2-core: untag user pointers in videobuf_dma_contig_user_get
|
2019-09-25 17:51:41 -07:00 |
|
memory
|
|
|
|
memstick
|
ms_block: fix spelling mistake "randomally" -> "randomly"
|
2019-09-11 16:11:01 +02:00 |
|
message
|
|
|
|
mfd
|
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
|
2019-09-29 10:24:23 -07:00 |
|
misc
|
Merge branch 'i2c/for-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
|
2019-09-24 16:48:02 -07:00 |
|
mmc
|
mmc: host: sdhci-pci: Add Genesys Logic GL975x support
|
2019-09-27 20:48:20 +02:00 |
|
mtd
|
Main MIPS changes for v5.4:
|
2019-09-22 09:30:30 -07:00 |
|
mux
|
|
|
|
net
|
netdevsim: Fix error handling in nsim_fib_init and nsim_fib_exit
|
2019-10-13 11:30:14 -07:00 |
|
nfc
|
NFC: pn533: fix use-after-free and memleaks
|
2019-10-08 16:52:26 -07:00 |
|
ntb
|
NTB: fix IDT Kconfig typos/spellos
|
2019-09-23 17:20:40 -04:00 |
|
nubus
|
|
|
|
nvdimm
|
libnvdimm fixes v5.4-rc1
|
2019-09-29 10:33:41 -07:00 |
|
nvme
|
Merge branch 'nvme-5.4' of git://git.infradead.org/nvme into for-linus
|
2019-09-27 13:17:37 -06:00 |
|
nvmem
|
Char/Misc driver patches for 5.4-rc1
|
2019-09-18 11:14:31 -07:00 |
|
of
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
|
2019-09-28 17:47:33 -07:00 |
|
opp
|
|
|
|
oprofile
|
|
|
|
parisc
|
dma-mapping updates for 5.4:
|
2019-09-19 13:27:23 -07:00 |
|
parport
|
Char/Misc driver patches for 5.4-rc1
|
2019-09-18 11:14:31 -07:00 |
|
pci
|
Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
|
2019-09-28 08:14:15 -07:00 |
|
pcmcia
|
Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
|
2019-09-28 08:14:15 -07:00 |
|
perf
|
|
|
|
phy
|
pci-v5.4-changes
|
2019-09-23 19:16:01 -07:00 |
|
pinctrl
|
This is the bulk of pin control changes for the v5.4 kernel
|
2019-09-19 14:19:33 -07:00 |
|
platform
|
platform-drivers-x86 for v5.4-2
|
2019-09-24 12:39:40 -07:00 |
|
pnp
|
|
|
|
power
|
power supply and reset changes for the v5.4 series
|
2019-09-22 12:04:59 -07:00 |
|
powercap
|
Power management updates for 5.4-rc1
|
2019-09-17 19:15:14 -07:00 |
|
pps
|
|
|
|
ps3
|
|
|
|
ptp
|
ptp: fix typo of "mechanism" in Kconfig help text
|
2019-10-07 14:55:46 -04:00 |
|
pwm
|
pwm: Changes for v5.4-rc1
|
2019-09-27 12:19:47 -07:00 |
|
rapidio
|
|
|
|
ras
|
|
|
|
regulator
|
LED updates for 5.4-rc1
|
2019-09-17 18:40:42 -07:00 |
|
remoteproc
|
remoteproc updates for v5.4
|
2019-09-22 10:55:08 -07:00 |
|
reset
|
ARM: SoC fixes
|
2019-09-30 10:04:28 -07:00 |
|
rpmsg
|
rpmsg: glink-smem: Name the edge based on parent remoteproc
|
2019-09-17 15:33:31 -07:00 |
|
rtc
|
RTC for 5.4
|
2019-09-22 11:05:43 -07:00 |
|
s390
|
s390/qeth: Fix initialization of vnicc cmd masks during set online
|
2019-10-09 17:55:24 -07:00 |
|
sbus
|
|
|
|
scsi
|
SCSI fixes on 20191004
|
2019-10-05 12:53:27 -07:00 |
|
sfi
|
|
|
|
sh
|
|
|
|
siox
|
|
|
|
slimbus
|
|
|
|
soc
|
ARM: SoC driver updates for v5.4
|
2019-09-16 15:52:38 -07:00 |
|
soundwire
|
soundwire updates for v5.4-rc1
|
2019-09-22 10:52:23 -07:00 |
|
spi
|
LED updates for 5.4-rc1
|
2019-09-17 18:40:42 -07:00 |
|
spmi
|
|
|
|
ssb
|
ssb: make array pwr_info_offset static const, makes object smaller
|
2019-09-13 17:23:18 +03:00 |
|
staging
|
netfilter: drop bridge nf reset from nf_reset
|
2019-10-01 18:42:15 +02:00 |
|
target
|
mm: introduce page_size()
|
2019-09-24 15:54:08 -07:00 |
|
tc
|
|
|
|
tee
|
tee/shm: untag user pointers in tee_shm_register
|
2019-09-25 17:51:41 -07:00 |
|
thermal
|
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
|
2019-09-29 10:24:23 -07:00 |
|
thunderbolt
|
|
|
|
tty
|
Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
|
2019-09-28 08:14:15 -07:00 |
|
uio
|
Char/Misc driver patches for 5.4-rc1
|
2019-09-18 11:14:31 -07:00 |
|
usb
|
Merge branch 'work.mount3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
|
2019-09-24 12:33:34 -07:00 |
|
vfio
|
vfio/type1: untag user pointers in vaddr_get_pfn
|
2019-09-25 17:51:41 -07:00 |
|
vhost
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
|
2019-09-15 14:17:27 +02:00 |
|
video
|
video/logo: do not generate unneeded logo C files
|
2019-10-05 15:29:49 +09:00 |
|
virt
|
|
|
|
virtio
|
virtio_ring: fix unmap of indirect descriptors
|
2019-09-09 10:43:15 -04:00 |
|
visorbus
|
|
|
|
vlynq
|
|
|
|
vme
|
|
|
|
w1
|
|
|
|
watchdog
|
linux-watchdog 5.4-rc1 tag
|
2019-09-27 11:17:38 -07:00 |
|
xen
|
net: add {READ|WRITE}_ONCE() annotations on ->rskq_accept_head
|
2019-10-09 21:34:31 -07:00 |
|
zorro
|
|
|
|
Kconfig
|
Staging/IIO driver patches for 5.4-rc1
|
2019-09-18 11:05:34 -07:00 |
|
Makefile
|
Staging/IIO driver patches for 5.4-rc1
|
2019-09-18 11:05:34 -07:00 |