Use netdev_notifier_info_to_dev(), needed for Linux 3.11+
authorPavel Roskin <proski@gnu.org>
Fri, 8 Nov 2013 21:42:54 +0000 (16:42 -0500)
committerPavel Roskin <proski@gnu.org>
Fri, 8 Nov 2013 22:01:34 +0000 (17:01 -0500)
Not using netdev_notifier_info_to_dev() gives no compile warnings but
crashes the kernel, so this patch is intentionally applied before Linux
3.10 procfs support is enabled to avoid a revision that compiles and
crashes on new kernels.

ath/if_ath.c
include/compat.h
net80211/ieee80211_linux.c

index a0d7eb8a5a37cb877f3251af36eb8d6fe0c93a0f..1c87bba45bf881d69269ba37beee4b2bc1a85e84 100644 (file)
@@ -12359,7 +12359,7 @@ static int
 ath_rcv_dev_event(struct notifier_block *this, unsigned long event,
        void *ptr)
 {
-       struct net_device *dev = (struct net_device *)ptr;
+       struct net_device *dev = netdev_notifier_info_to_dev(ptr);
        struct ath_softc *sc = (struct ath_softc *)netdev_priv(dev);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
index c29f57ab279caf37aa842f94e7bc818a9aaa763a..700229b47739bb7f26eb249246e2b1afa27211d2 100644 (file)
@@ -242,6 +242,10 @@ typedef unsigned long resource_size_t;
 #endif
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
+#define netdev_notifier_info_to_dev(ptr) ((struct net_device *)(ptr))
+#endif
+
 #endif /* __KERNEL__ */
 
 #endif /* _ATH_COMPAT_H_ */
index c954aeb652b09fcc995f13ecf9ff6c1f4abe4d77..a97bedb72675d397a713fa364641e4397e7b02b6 100644 (file)
@@ -1186,7 +1186,7 @@ static int
 ieee80211_rcv_dev_event(struct notifier_block *this, unsigned long event,
        void *ptr)
 {
-       struct net_device *dev = (struct net_device *)ptr;
+       struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
        if (!dev || dev->open != &ieee80211_open)