linux/drivers
Tony Battersby a45835a0bb bonding: fix oops during rmmod
"rmmod bonding" causes an oops ever since commit cc317ea3d9 ("bonding:
remove redundant NULL check in debugfs function").  Here are the relevant
functions being called:

bonding_exit()
  bond_destroy_debugfs()
    debugfs_remove_recursive(bonding_debug_root);
    bonding_debug_root = NULL; <--------- SET TO NULL HERE
  bond_netlink_fini()
    rtnl_link_unregister()
      __rtnl_link_unregister()
        unregister_netdevice_many_notify()
          bond_uninit()
            bond_debug_unregister()
              (commit removed check for bonding_debug_root == NULL)
              debugfs_remove()
              simple_recursive_removal()
                down_write() -> OOPS

However, reverting the bad commit does not solve the problem completely
because the original code contains a race that could cause the same
oops, although it was much less likely to be triggered unintentionally:

CPU1
  rmmod bonding
    bonding_exit()
      bond_destroy_debugfs()
        debugfs_remove_recursive(bonding_debug_root);

CPU2
  echo -bond0 > /sys/class/net/bonding_masters
    bond_uninit()
      bond_debug_unregister()
        if (!bonding_debug_root)

CPU1
        bonding_debug_root = NULL;

So do NOT revert the bad commit (since the removed checks were racy
anyway), and instead change the order of actions taken during module
removal.  The same oops can also happen if there is an error during
module init, so apply the same fix there.

Fixes: cc317ea3d9 ("bonding: remove redundant NULL check in debugfs function")
Cc: stable@vger.kernel.org
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Link: https://lore.kernel.org/r/641f914f-3216-4eeb-87dd-91b78aa97773@cybernetics.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-05-16 19:33:07 -07:00
..
accel accel/ivpu: Fix deadlock in context_xa 2024-04-08 10:55:01 +02:00
accessibility speakup: Avoid crash on very long word 2024-04-11 14:32:53 +02:00
acpi hwmon updates for v6.10 2024-05-14 14:51:51 -07:00
amba
android binder: check offset alignment in binder_get_object() 2024-04-11 15:19:12 +02:00
ata SCSI misc on 20240514 2024-05-14 18:25:53 -07:00
atm atm/fore200e: Delete unused 'fore200e_boards' 2024-05-06 18:26:47 -07:00
auxdisplay auxdisplay: charlcd: Don't rebuild when CONFIG_PANEL_BOOT_MESSAGE=y 2024-04-11 13:34:29 +03:00
base regmap: Updates for v6.10 2024-05-14 14:30:24 -07:00
bcma bcma: convert to platform remove callback returning void 2024-03-12 17:32:55 +02:00
block for-6.10/block-20240511 2024-05-13 13:03:54 -07:00
bluetooth Bluetooth: btintel_pcie: Refactor and code cleanup 2024-05-14 10:58:30 -04:00
bus Networking changes for 6.10. 2024-05-14 19:42:24 -07:00
cache cache: sifive_ccache: Silence unused variable warning 2024-04-11 07:28:37 +01:00
cdrom cdrom: gdrom: Convert to platform remove callback returning void 2024-03-07 11:53:30 -07:00
cdx cdx: add MSI support for CDX bus 2024-03-07 21:52:03 +00:00
char This update includes the following changes: 2024-05-13 14:53:05 -07:00
clk soc: drivers for 6.10 2024-05-13 08:48:42 -07:00
clocksource clocksource/drivers/arm_arch_timer: Mark hisi_161010101_oem_info const 2024-05-10 10:43:21 +02:00
comedi comedi: vmk80xx: fix incomplete endpoint checking 2024-04-11 15:16:23 +02:00
connector
counter counter: fix privdata alignment 2024-02-16 18:51:00 -05:00
cpufreq Power management updates for 6.10-rc1 2024-05-14 13:19:15 -07:00
cpuidle Power management updates for 6.10-rc1 2024-05-14 13:19:15 -07:00
crypto Networking changes for 6.10. 2024-05-14 19:42:24 -07:00
cxl cxl: Fix cxl_endpoint_get_perf_coordinate() support for RCH 2024-04-29 09:03:26 -07:00
dax fs: claw back a few FMODE_* bits 2024-04-07 13:49:02 +02:00
dca
devfreq PM / devfreq: exynos: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions 2024-05-09 00:30:37 +09:00
dio dio: make dio_bus_type const 2024-03-07 20:37:04 +00:00
dma dmaengine: idxd: add a write() method for applications to submit work 2024-05-13 14:07:45 +00:00
dma-buf Merge drm/drm-fixes into drm-misc-fixes 2024-03-25 21:11:58 +01:00
dpll dpll: fix return value check for kmemdup 2024-05-13 16:53:53 -07:00
edac - Have skx_edac decode error addresses belonging to SGX properly 2024-05-14 08:31:10 -07:00
eisa alpha: remove DECpc AXP150 (Jensen) support 2024-05-03 22:09:50 +02:00
extcon
firewire firewire updates for v6.10 2024-05-14 18:57:22 -07:00
firmware EFI updates for v6.10: 2024-05-14 15:19:26 -07:00
fpga fpga: dfl-pci: add PCI subdevice ID for Intel D5005 card 2024-04-26 12:14:28 +08:00
fsi
gnss
gpio gpio updates for v6.10-rc1 2024-05-14 15:07:07 -07:00
gpu This update includes the following changes: 2024-05-13 14:53:05 -07:00
greybus Char/Misc and other driver subsystem updates for 6.9-rc1 2024-03-21 13:21:31 -07:00
hid Merge branch 'for-6.10/winwing' into for-linus 2024-05-14 13:58:46 +02:00
hsi HSI: ssi_protocol: fix struct members kernel-doc warnings 2024-02-25 19:05:45 +01:00
hte hte: tegra-194: Convert to platform remove callback returning void 2024-04-12 11:02:58 -07:00
hv hyperv-fixes for v6.9-rc4 2024-04-11 16:23:56 -07:00
hwmon pwm: Changes for v6.10-rc1 2024-05-14 15:03:19 -07:00
hwspinlock hwspinlock: omap: Use index to get hwspinlock pointer 2024-03-05 20:01:14 -08:00
hwtracing coresight-tpda: Change qcom,dsb-element-size to qcom,dsb-elem-bits 2024-02-27 11:26:45 +00:00
i2c i2c: smbus: fix NULL function pointer dereference 2024-04-27 12:57:57 +02:00
i3c i3c: Make i3c_bus_type const 2024-02-19 21:23:28 +01:00
idle cpuidle: ACPI/intel: fix MWAIT hint target C-state computation 2024-03-05 21:25:18 +01:00
iio regulator: Updates for v6.10 2024-05-14 14:36:09 -07:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-05-09 10:01:01 -07:00
input ACPI updates for 6.10-rc1 2024-05-14 13:31:24 -07:00
interconnect interconnect fixes for v6.9-rc 2024-04-11 14:44:49 +02:00
iommu X86 interrupt handling update: 2024-05-14 10:01:29 -07:00
ipack ipack: make ipack_bus_type const 2024-03-07 20:32:47 +00:00
irqchip Updates for the interrupt subsystem: 2024-05-14 09:47:14 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-04-11 14:23:47 -07:00
leds - Kuan-Wei Chiu has developed the well-named series "lib min_heap: Min 2024-03-14 18:03:09 -07:00
macintosh macintosh/via-macii: Fix "BUG: sleeping function called from invalid context" 2024-04-29 16:45:53 +02:00
mailbox imx: add support for i.MX95 ELE/V2X MU 2024-03-13 12:23:36 -07:00
mcb mcb: constify the struct device_type usage 2024-03-07 20:38:15 +00:00
md Networking changes for 6.10. 2024-05-14 19:42:24 -07:00
media media: mediatek: vcodec: support 36 bits physical address 2024-03-26 09:52:59 +01:00
memory memory: mtk-smi: fix module autoloading 2024-04-11 08:22:26 +02:00
memstick MMC core: 2024-03-13 10:59:28 -07:00
message SCSI misc on 20240514 2024-05-14 18:25:53 -07:00
mfd mfd: axp20x: Add support for AXP717 PMIC 2024-03-28 09:50:59 +00:00
misc hardening updates for 6.10-rc1 2024-05-13 14:14:05 -07:00
mmc Merge branches 'pm-cpuidle', 'pm-sleep' and 'pm-powercap' 2024-05-13 20:14:10 +02:00
most most: core: make mostbus const 2024-03-07 20:32:38 +00:00
mtd There has been OTP support improvements in the NVMEM subsystem, and 2024-04-26 13:05:34 -07:00
mux
net bonding: fix oops during rmmod 2024-05-16 19:33:07 -07:00
nfc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-04-25 12:41:37 -07:00
ntb NTB: fix possible name leak in ntb_register_device() 2024-02-16 16:13:38 +05:30
nubus
nvdimm libnvdimm updates for v6.9 2024-03-15 11:58:32 -07:00
nvme for-6.10/block-20240511 2024-05-13 13:03:54 -07:00
nvmem nvmem: core: Print error on wrong bits DT property 2024-03-07 20:21:53 +00:00
of Networking changes for 6.10. 2024-05-14 19:42:24 -07:00
opp OPP: OF: Export dev_opp_pm_calc_power() for usage from EM 2024-04-08 16:05:14 +02:00
parisc parisc: led: Convert to platform remove callback returning void 2024-03-08 10:00:07 +01:00
parport parport: sunbpp: Convert to platform remove callback returning void 2024-03-07 21:50:06 +00:00
pci pci-v6.9-fixes-2 2024-05-08 09:37:58 -07:00
pcmcia pcmcia: cs: make pcmcia_socket_class constant 2024-03-10 09:07:00 +01:00
peci
perf drivers/perf: hisi: hns3: Actually use devm_add_action_or_reset() 2024-04-28 08:49:31 +01:00
phy phy: ti: tusb1210: Resolve charger-det crash if charger psy is unregistered 2024-04-12 16:57:19 +05:30
pinctrl gpio updates for v6.10-rc1 2024-05-14 15:07:07 -07:00
platform ACPI updates for 6.10-rc1 2024-05-14 13:31:24 -07:00
pmdomain Core: 2024-03-13 11:33:10 -07:00
pnp PNP: add HAS_IOPORT dependencies 2024-04-22 18:30:39 +02:00
power power: supply: mt6360_charger: Fix of_match for usb-otg-vbus regulator 2024-04-15 13:31:37 +02:00
powercap powercap: intel_rapl_tpmi: Enable PMU support 2024-04-30 21:10:37 +02:00
pps pps: use cflags-y instead of EXTRA_CFLAGS 2024-03-07 21:51:39 +00:00
ps3
ptp Networking changes for 6.10. 2024-05-14 19:42:24 -07:00
pwm pwm: pca9685: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-05-10 07:30:27 +02:00
rapidio
ras RAS: Avoid build errors when CONFIG_DEBUG_FS=n 2024-03-26 21:48:21 +01:00
regulator regulator: Updates for v6.10 2024-05-14 14:36:09 -07:00
remoteproc remoteproc updates for v6.9 2024-03-21 10:37:39 -07:00
reset reset: k210: Deprecate SOC_CANAAN and use SOC_CANAAN_K210 2024-04-05 16:42:51 +01:00
rpmsg
rtc RTC for 6.9 2024-03-21 17:16:46 -07:00
s390 Networking changes for 6.10. 2024-05-14 19:42:24 -07:00
sbus This includes the following changes related to sparc for v6.9: 2024-03-15 12:47:21 -07:00
scsi SCSI misc on 20240514 2024-05-14 18:25:53 -07:00
sh
siox SIOX changes for 6.9-rc1 2024-03-21 15:18:18 -07:00
slimbus slimbus: qcom-ngd-ctrl: Add timeout for wait operation 2024-05-03 07:30:32 +02:00
soc spi: Updates for v6.10 2024-05-14 14:41:01 -07:00
soundwire soundwire: amd: fix for wake interrupt handling for clockstop mode 2024-03-28 23:40:33 +05:30
spi spi: Updates for v6.10 2024-05-14 14:41:01 -07:00
spmi
ssb ssb: use "break" on default case to prevent warning 2024-03-14 10:56:31 +02:00
staging SCSI misc on 20240514 2024-05-14 18:25:53 -07:00
target SCSI misc on 20240514 2024-05-14 18:25:53 -07:00
tc tc: make tc_bus_type const 2024-02-20 13:36:34 +01:00
tee TEE driver for Trusted Services 2024-04-29 22:29:44 +02:00
thermal ACPI updates for 6.10-rc1 2024-05-14 13:31:24 -07:00
thunderbolt thunderbolt: Avoid notify PM core about runtime PM resume 2024-04-10 10:49:58 +03:00
tty alpha: cleanups and build fixes 2024-05-13 09:14:57 -07:00
ufs SCSI misc on 20240514 2024-05-14 18:25:53 -07:00
uio hyperv-fixes for v6.9-rc4 2024-04-11 16:23:56 -07:00
usb SCSI misc on 20240514 2024-05-14 18:25:53 -07:00
vdpa vDPA: code clean for vhost_vdpa uapi 2024-04-22 17:07:13 -04:00
vfio VFIO: Add the SPR_DSA and SPR_IAX devices to the denylist 2024-05-13 14:07:33 +00:00
vhost net: extend ubuf_info callback to ops structure 2024-04-22 16:21:35 -07:00
video fbdev: fix incorrect address computation in deferred IO 2024-04-24 15:03:37 +02:00
virt ACPI updates for 6.10-rc1 2024-05-14 13:31:24 -07:00
virtio virtio_ring: enable premapped mode whatever use_dma_api 2024-05-13 17:07:41 -07:00
w1 w1: w1-gpio: Convert to platform remove callback returning void 2024-02-20 11:24:34 +01:00
watchdog linux-watchdog 6.9-rc1 tag 2024-03-17 12:06:10 -07:00
xen xen: branch for v6.9-rc1 2024-03-19 08:48:09 -07:00
zorro zorro: Use helpers from ioport.h 2024-04-29 16:45:53 +02:00
Kconfig
Makefile Revert "leds: Only descend into leds directory when CONFIG_NEW_LEDS is set" 2024-03-07 08:48:10 +00:00