005-fix-netdevice-notifier.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 010badc96adbafed214d9cba0236a8a832dbfc77 Mon Sep 17 00:00:00 2001
  2. From: Liangbin Lian <[email protected]>
  3. Date: Mon, 21 Aug 2023 10:26:28 +0800
  4. Subject: [PATCH] fix netdevice notifier
  5. rtw_ndev_notifier_call should ignore network devices created by other drivers,
  6. and it does so, but when CONFIG_WIRELESS_EXT=n, it does not behave as expected.
  7. ---
  8. os_dep/linux/os_intfs.c | 9 +++++++++
  9. 1 file changed, 9 insertions(+)
  10. --- a/os_dep/linux/os_intfs.c
  11. +++ b/os_dep/linux/os_intfs.c
  12. @@ -746,6 +746,8 @@ u16 rtw_recv_select_queue(struct sk_buff
  13. }
  14. #endif
  15. +int rtw_ndev_init(struct net_device *dev);
  16. +
  17. static int rtw_ndev_notifier_call(struct notifier_block * nb, unsigned long state, void *ptr)
  18. {
  19. #if (LINUX_VERSION_CODE>=KERNEL_VERSION(3,11,0))
  20. @@ -761,6 +763,13 @@ static int rtw_ndev_notifier_call(struct
  21. if (dev->do_ioctl != rtw_ioctl)
  22. #endif
  23. return NOTIFY_DONE;
  24. +#else
  25. +#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
  26. + if (dev->netdev_ops->ndo_init != rtw_ndev_init)
  27. +#else
  28. + if (dev->init != rtw_ndev_init)
  29. +#endif
  30. + return NOTIFY_DONE;
  31. #endif
  32. DBG_871X_LEVEL(_drv_info_, FUNC_NDEV_FMT" state:%lu\n", FUNC_NDEV_ARG(dev), state);