openwrt/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch

36 lines
1.4 KiB
Diff
Raw Normal View History

generic: backport ("net: free_netdev: exit earlier if dummy") Currently, when removing ath11k or any other driver that uses dummy netdev kernel will crash with: [ 365.004961] ------------[ cut here ]------------ [ 365.004992] kernel BUG at net/core/dev.c:10979! [ 365.008642] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP [ 365.012898] Modules linked in: pppoe ppp_async nft_fib_inet nf_flow_table_inet ath11k_ahb(O) ath11k(O) pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_c [ 365.064794] CPU: 3 PID: 3896 Comm: procd Tainted: G O 6.6.52 #0 [ 365.087031] Hardware name: QNAP 301w (DT) [ 365.094058] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 365.098229] pc : free_netdev+0x164/0x1a0 [ 365.104994] lr : free_netdev+0xec/0x1a0 [ 365.109159] sp : ffffffc081d33b90 [ 365.112718] x29: ffffffc081d33b90 x28: ffffff80039d3c00 x27: ffffff800307f000 [ 365.116199] x26: ffffff800538a000 x25: ffffff8005388000 x24: ffffff800538a4c0 [ 365.123317] x23: 00000000000023a4 x22: ffffff8005388f68 x21: ffffff8004e37050 [ 365.130434] x20: ffffff8004e37000 x19: ffffff8004e36ee8 x18: 0000000000000152 [ 365.137552] x17: 63775f357636712e x16: 3030303030646320 x15: ffffffc081436e20 [ 365.144670] x14: ffffff80033f261c x13: 00000000000000d9 x12: 0000000000000002 [ 365.151789] x11: 0000000000000000 x10: 00000000000008a0 x9 : ffffffc081d33980 [ 365.158906] x8 : ffffff80039d4500 x7 : ffffff803fdda6c0 x6 : 0000000000000007 [ 365.166025] x5 : 0000000000000000 x4 : 00000000000000c1 x3 : 00000000000001f4 [ 365.173143] x2 : ffffff803fdd4b78 x1 : ffffff8004e37050 x0 : 0000000000000005 [ 365.180261] Call trace: [ 365.187370] free_netdev+0x164/0x1a0 [ 365.189630] 0xffffffc079b373f0 [ 365.193447] 0xffffffc079b374c0 [ 365.196311] platform_shutdown+0x24/0x34 [ 365.199438] device_shutdown+0x160/0x268 [ 365.203605] kernel_restart+0x40/0xc0 [ 365.207510] __do_sys_reboot+0x104/0x220 [ 365.211070] __arm64_sys_reboot+0x24/0x30 [ 365.215063] invoke_syscall.constprop.0+0x5c/0x108 [ 365.218971] do_el0_svc+0x40/0xc8 [ 365.223655] el0_svc+0x30/0xb8 [ 365.227041] el0t_64_sync_handler+0x120/0x12c [ 365.229995] el0t_64_sync+0x178/0x17c [ 365.234424] Code: f94013f5 a8c37bfd d50323bf d65f03c0 (d4210000) [ 365.238072] ---[ end trace 0000000000000000 ]--- Wireless backports include alloc_netdev_dummy() backport but they dont have the required free_netdev change first, so backport it. Fixes: #16531 Fixes: 384d079fd876 ("mac80211: update to version 6.11") Link: https://github.com/openwrt/openwrt/pull/16549 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-09-30 10:13:42 +00:00
From f8d05679fb3faae478d604177b0c188b340371cd Mon Sep 17 00:00:00 2001
From: Breno Leitao <leitao@debian.org>
Date: Mon, 22 Apr 2024 05:38:55 -0700
Subject: [PATCH] net: free_netdev: exit earlier if dummy
For dummy devices, exit earlier at free_netdev() instead of executing
the whole function. This is necessary, because dummy devices are
special, and shouldn't have the second part of the function executed.
Otherwise reg_state, which is NETREG_DUMMY, will be overwritten and
there will be no way to identify that this is a dummy device. Also, this
device do not need the final put_device(), since dummy devices are not
registered (through register_netdevice()), where the device reference is
increased (at netdev_register_kobject()/device_add()).
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/core/dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/net/core/dev.c
+++ b/net/core/dev.c
kernel: bump 6.6 to 6.6.55 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.55 Added the following default ksym to target/linux/generic/config-6.6: CONFIG_PROC_MEM_ALWAYS_FORCE=y # CONFIG_PROC_MEM_FORCE_PTRACE is not set # CONFIG_PROC_MEM_NO_FORCE is not set Removed upstreamed: generic/backport-6.6/780-23-v6.12-r8169-Fix-spelling-mistake-tx_underun-tx_underrun.patch[1] generic/backport-6.6/780-25-v6.12-r8169-add-tally-counter-fields-added-with-RTL8125.patch[2] generic/pending-6.6/684-gso-fix-gso-fraglist-segmentation-after-pull-from-fr.patch[3] lantiq/patches-6.6/0025-v6.12-net-ethernet-lantiq_etop-fix-memory-disclosure.patch[4] Manually rebased: bcm27xx/patches-6.6/950-0086-Main-bcm2708-bcm2709-linux-port.patch bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.56&id=f02fcb7283b1c25f7e3ae07d7a2c830e06eb1a62 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.56&id=1c723d785adb711496bc64c24240f952f4faaabf 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.56&id=af3122f5fdc0d00581d6e598a668df6bf54c9daa 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.56&id=e66e38d07b31e177ca430758ed97fbc79f27d966 Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/16655 Signed-off-by: Nick Hainke <vincent@systemli.org>
2024-10-10 20:06:27 +00:00
@@ -10972,7 +10972,8 @@ void free_netdev(struct net_device *dev)
generic: backport ("net: free_netdev: exit earlier if dummy") Currently, when removing ath11k or any other driver that uses dummy netdev kernel will crash with: [ 365.004961] ------------[ cut here ]------------ [ 365.004992] kernel BUG at net/core/dev.c:10979! [ 365.008642] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP [ 365.012898] Modules linked in: pppoe ppp_async nft_fib_inet nf_flow_table_inet ath11k_ahb(O) ath11k(O) pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_c [ 365.064794] CPU: 3 PID: 3896 Comm: procd Tainted: G O 6.6.52 #0 [ 365.087031] Hardware name: QNAP 301w (DT) [ 365.094058] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 365.098229] pc : free_netdev+0x164/0x1a0 [ 365.104994] lr : free_netdev+0xec/0x1a0 [ 365.109159] sp : ffffffc081d33b90 [ 365.112718] x29: ffffffc081d33b90 x28: ffffff80039d3c00 x27: ffffff800307f000 [ 365.116199] x26: ffffff800538a000 x25: ffffff8005388000 x24: ffffff800538a4c0 [ 365.123317] x23: 00000000000023a4 x22: ffffff8005388f68 x21: ffffff8004e37050 [ 365.130434] x20: ffffff8004e37000 x19: ffffff8004e36ee8 x18: 0000000000000152 [ 365.137552] x17: 63775f357636712e x16: 3030303030646320 x15: ffffffc081436e20 [ 365.144670] x14: ffffff80033f261c x13: 00000000000000d9 x12: 0000000000000002 [ 365.151789] x11: 0000000000000000 x10: 00000000000008a0 x9 : ffffffc081d33980 [ 365.158906] x8 : ffffff80039d4500 x7 : ffffff803fdda6c0 x6 : 0000000000000007 [ 365.166025] x5 : 0000000000000000 x4 : 00000000000000c1 x3 : 00000000000001f4 [ 365.173143] x2 : ffffff803fdd4b78 x1 : ffffff8004e37050 x0 : 0000000000000005 [ 365.180261] Call trace: [ 365.187370] free_netdev+0x164/0x1a0 [ 365.189630] 0xffffffc079b373f0 [ 365.193447] 0xffffffc079b374c0 [ 365.196311] platform_shutdown+0x24/0x34 [ 365.199438] device_shutdown+0x160/0x268 [ 365.203605] kernel_restart+0x40/0xc0 [ 365.207510] __do_sys_reboot+0x104/0x220 [ 365.211070] __arm64_sys_reboot+0x24/0x30 [ 365.215063] invoke_syscall.constprop.0+0x5c/0x108 [ 365.218971] do_el0_svc+0x40/0xc8 [ 365.223655] el0_svc+0x30/0xb8 [ 365.227041] el0t_64_sync_handler+0x120/0x12c [ 365.229995] el0t_64_sync+0x178/0x17c [ 365.234424] Code: f94013f5 a8c37bfd d50323bf d65f03c0 (d4210000) [ 365.238072] ---[ end trace 0000000000000000 ]--- Wireless backports include alloc_netdev_dummy() backport but they dont have the required free_netdev change first, so backport it. Fixes: #16531 Fixes: 384d079fd876 ("mac80211: update to version 6.11") Link: https://github.com/openwrt/openwrt/pull/16549 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-09-30 10:13:42 +00:00
dev->xdp_bulkq = NULL;
/* Compatibility with error handling in drivers */
- if (dev->reg_state == NETREG_UNINITIALIZED) {
+ if (dev->reg_state == NETREG_UNINITIALIZED ||
+ dev->reg_state == NETREG_DUMMY) {
netdev_freemem(dev);
return;
}