linux-stable/drivers
Martin Willi 2f20958448 can: dev: Move device back to init netns on owning netns delete
commit 3a5ca85707 upstream.

When a non-initial netns is destroyed, the usual policy is to delete
all virtual network interfaces contained, but move physical interfaces
back to the initial netns. This keeps the physical interface visible
on the system.

CAN devices are somewhat special, as they define rtnl_link_ops even
if they are physical devices. If a CAN interface is moved into a
non-initial netns, destroying that netns lets the interface vanish
instead of moving it back to the initial netns. default_device_exit()
skips CAN interfaces due to having rtnl_link_ops set. Reproducer:

  ip netns add foo
  ip link set can0 netns foo
  ip netns delete foo

WARNING: CPU: 1 PID: 84 at net/core/dev.c:11030 ops_exit_list+0x38/0x60
CPU: 1 PID: 84 Comm: kworker/u4:2 Not tainted 5.10.19 #1
Workqueue: netns cleanup_net
[<c010e700>] (unwind_backtrace) from [<c010a1d8>] (show_stack+0x10/0x14)
[<c010a1d8>] (show_stack) from [<c086dc10>] (dump_stack+0x94/0xa8)
[<c086dc10>] (dump_stack) from [<c086b938>] (__warn+0xb8/0x114)
[<c086b938>] (__warn) from [<c086ba10>] (warn_slowpath_fmt+0x7c/0xac)
[<c086ba10>] (warn_slowpath_fmt) from [<c0629f20>] (ops_exit_list+0x38/0x60)
[<c0629f20>] (ops_exit_list) from [<c062a5c4>] (cleanup_net+0x230/0x380)
[<c062a5c4>] (cleanup_net) from [<c0142c20>] (process_one_work+0x1d8/0x438)
[<c0142c20>] (process_one_work) from [<c0142ee4>] (worker_thread+0x64/0x5a8)
[<c0142ee4>] (worker_thread) from [<c0148a98>] (kthread+0x148/0x14c)
[<c0148a98>] (kthread) from [<c0100148>] (ret_from_fork+0x14/0x2c)

To properly restore physical CAN devices to the initial netns on owning
netns exit, introduce a flag on rtnl_link_ops that can be set by drivers.
For CAN devices setting this flag, default_device_exit() considers them
non-virtual, applying the usual namespace move.

The issue was introduced in the commit mentioned below, as at that time
CAN devices did not have a dellink() operation.

Fixes: e008b5fc8d ("net: Simplfy default_device_exit and improve batching.")
Link: https://lore.kernel.org/r/20210302122423.872326-1-martin@strongswan.org
Signed-off-by: Martin Willi <martin@strongswan.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-30 14:40:12 +02:00
..
accessibility
acpi ACPI: scan: Use unique number for instance_no 2021-03-30 14:40:12 +02:00
amba amba: Fix resource leak for drivers without .remove 2021-03-03 18:22:46 +01:00
android
ata ata: ahci_brcm: Add back regulators management 2021-03-03 18:22:43 +01:00
atm atm: idt77252: fix null-ptr-dereference 2021-03-30 14:40:09 +02:00
auxdisplay auxdisplay: ht16k33: Fix refresh rate handling 2021-03-03 18:22:46 +01:00
base Revert "PM: runtime: Update device status before letting suppliers suspend" 2021-03-24 11:04:55 +01:00
bcma
block block: rsxx: fix error return code of rsxx_pci_probe() 2021-03-17 16:34:34 +01:00
bluetooth Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function 2021-03-03 18:22:37 +01:00
bus bus: omap_l3_noc: mark l3 irqs as IRQF_NO_THREAD 2021-03-30 14:40:10 +02:00
cdrom
char tpm_tis: Fix check_locality for correct locality acquisition 2021-03-03 18:22:52 +01:00
clk clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL 2021-03-03 18:22:44 +01:00
clocksource clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined 2021-03-03 18:22:45 +01:00
connector
cpufreq cpufreq: brcmstb-avs-cpufreq: Fix resource leaks in ->remove() 2021-03-03 18:22:38 +01:00
cpuidle
crypto crypto: sun4i-ss - handle BigEndian for cipher 2021-03-03 18:22:53 +01:00
dax
dca
devfreq
dio
dma dmaengine: hsu: disable spurious interrupt 2021-03-03 18:22:45 +01:00
dma-buf
edac EDAC/amd64: Fix PCI component registration 2020-12-29 13:47:06 +01:00
eisa
extcon extcon: max77693: Fix modalias string 2020-12-29 13:47:01 +01:00
firewire
firmware
fmc
fpga
fsi
gpio gpiolib: acpi: Add missing IRQF_ONESHOT 2021-03-30 14:40:08 +02:00
gpu drm/msm: fix shutdown hook in case GPU components failed to bind 2021-03-30 14:40:11 +02:00
hid HID: wacom: Ignore attempts to overwrite the touch_max value from HID 2021-03-03 18:22:51 +01:00
hsi HSI: omap_ssi: Don't jump to free ID in ssi_add_controller() 2020-12-29 13:46:56 +01:00
hv Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind() 2021-03-03 18:22:43 +01:00
hwmon hwmon: (lm90) Fix max6658 sporadic wrong temperature reading 2021-03-17 16:34:35 +01:00
hwspinlock
hwtracing stm class: Fix module init return on allocation failure 2021-01-30 13:31:14 +01:00
i2c i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition 2021-03-03 18:22:50 +01:00
ide scsi: ide: Do not set the RQF_PREEMPT flag for sense requests 2021-01-12 20:09:05 +01:00
idle
iio iio: hid-sensor-temperature: Fix issues of timestamp channel 2021-03-24 11:05:04 +01:00
infiniband RDMA/cxgb4: Fix adapter LE hash errors while destroying ipv6 listening server 2021-03-30 14:40:11 +02:00
input Input: i8042 - add ASUS Zenbook Flip to noselftest list 2021-03-03 18:22:51 +01:00
iommu iommu/amd: Fix sleeping in atomic in increase_address_space() 2021-03-11 13:51:05 +01:00
ipack
irqchip irqchip/mips-cpu: Set IPI domain parent chip 2021-01-30 13:31:13 +01:00
isdn misdn: dsp: select CONFIG_BITREVERSE 2021-01-23 15:48:42 +01:00
leds leds: trigger: fix potential deadlock with libata 2021-02-03 23:22:21 +01:00
lightnvm
macintosh
mailbox
mcb
md dm ioctl: fix out of bounds array access when no devices 2021-03-30 14:40:10 +02:00
media media: usbtv: Fix deadlock on suspend 2021-03-17 16:34:30 +01:00
memory memory: emif: Remove bogus debugfs error handling 2020-11-05 11:06:57 +01:00
memstick memstick: r592: Fix error return in r592_probe() 2020-12-29 13:46:58 +01:00
message scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove() 2020-11-05 11:06:59 +01:00
mfd mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq() 2021-03-03 18:22:47 +01:00
misc misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eeprom 2021-03-11 13:51:06 +01:00
mmc mmc: core: Fix partition switch time for eMMC 2021-03-17 16:34:31 +01:00
mtd mtd: spi-nor: hisi-sfc: Put child node np on error path 2021-03-03 18:22:54 +01:00
mux
net can: dev: Move device back to init netns on owning netns delete 2021-03-30 14:40:12 +02:00
nfc nfc: s3fwrn5: Release the nfc firmware 2020-12-29 13:47:02 +01:00
ntb
nubus
nvdimm libnvdimm/dimm: Avoid race between probe and available_slots_show() 2021-03-03 18:22:54 +01:00
nvme nvme-rdma: fix possible hang when failing to set io queues 2021-03-24 11:05:01 +01:00
nvmem
of of/fdt: Make sure no-map does not remove already reserved regions 2021-03-03 18:22:45 +01:00
oprofile
parisc
parport
pci PCI: rpadlpar: Fix potential drc_name corruption in store functions 2021-03-24 11:05:04 +01:00
pcmcia
perf
phy phy: cpcap-usb: Fix warning for missing regulator_disable 2021-02-07 14:47:40 +01:00
pinctrl pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe() 2020-12-29 13:46:58 +01:00
platform platform/x86: acer-wmi: Add ACER_CAP_KBD_DOCK quirk for the Aspire Switch 10E SW3-016 2021-03-11 13:51:05 +01:00
pnp
power power: reset: at91-sama5d2_shdwc: fix wkupdbc mask 2021-03-03 18:22:45 +01:00
powercap powercap: restrict energy meter to root access 2020-11-10 21:10:28 +01:00
pps
ps3 powerpc/ps3: use dma_mapping_error() 2020-12-29 13:47:02 +01:00
ptp
pwm pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare() 2021-03-03 18:22:48 +01:00
rapidio
ras
regulator regulator: axp20x: Fix reference cout leak 2021-03-03 18:22:45 +01:00
remoteproc remoteproc: qcom_q6v5_mss: Validate MBA firmware size before load 2021-02-23 14:00:29 +01:00
reset
rpmsg
rtc rtc: s5m: select REGMAP_I2C 2021-03-03 18:22:45 +01:00
s390 s390/dasd: fix hanging IO request during DASD driver unbind 2021-03-17 16:34:31 +01:00
sbus
scsi scsi: mpt3sas: Fix error return code of mpt3sas_base_attach() 2021-03-30 14:40:12 +02:00
sfi
sh
sn
soc drivers: soc: atmel: add null entry at the end of at91_soc_allowed_list[] 2021-02-03 23:22:21 +01:00
spi spi: pxa2xx: Fix the controller numbering for Wildcat Point 2021-03-03 18:22:47 +01:00
spmi
ssb
staging staging: comedi: pcl818: Fix endian problem for AI command data 2021-03-17 16:34:34 +01:00
target scsi: target: Fix XCOPY NAA identifier lookup 2021-01-12 20:09:14 +01:00
tc
tee
thermal
thunderbolt thunderbolt: Add the missed ida_simple_remove() in ring_request_msix() 2020-11-18 18:27:58 +01:00
tty vt/consolemap: do font sum unsigned 2021-03-07 11:27:44 +01:00
uio uio: Fix use-after-free in uio_unregister_device() 2020-11-18 18:27:58 +01:00
usb usb: gadget: configfs: Fix KASAN use-after-free 2021-03-24 11:05:02 +01:00
uwb
vfio vfio/pci: Move dummy_resources_list init in vfio_pci_probe() 2021-01-09 13:37:37 +01:00
vhost vhost_net: fix ubuf refcount incorrectly when sendmsg fails 2021-01-12 20:09:08 +01:00
video fbdev: aty: SPARC64 requires FB_ATY_CT 2021-03-03 18:22:40 +01:00
virt
virtio
vlynq
vme
w1 w1: mxc_w1: Fix timeout resolution problem leading to bus error 2020-11-05 11:06:59 +01:00
watchdog watchdog: mei_wdt: request stop on unregister 2021-03-03 18:22:54 +01:00
xen xen/events: avoid handling the same event on two cpus at the same time 2021-03-17 16:34:35 +01:00
zorro
Kconfig
Makefile