batman-adv: Only enable priv_destructor compat for < 4.11.9

Message ID 20170721091709.7978-1-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit 33cc78db4852ee8d07f2c21dca9f297dd3b2ccef
Delegated to: Simon Wunderlich
Headers

Commit Message

Sven Eckelmann July 21, 2017, 9:17 a.m. UTC
  The teardown netdev API change 33e9de0c769c ("batman-adv: Fix inconsistent
teardown and release of private netdev state.") was backported to Linux
4.11.9. The compat code to switch back to the old style destructor code
must therefore not be enabled for Linux >= 4.11.9.

Reported-by: Ruben Kelevra <cyrond@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 compat-include/linux/netdevice.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Sven Eckelmann July 21, 2017, 9:35 a.m. UTC | #1
On Freitag, 21. Juli 2017 11:17:09 CEST Sven Eckelmann wrote:
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 9)

The other option would have been

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && \
    (LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 9) || \
     LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))

But it should be enough to use the shorter version for this stable kernel. But 
we may need the other version for older kernels (not sure whether it will be 
backported to 4.9.x, 4.4.x, 4.1.x, 3.16.x, 3.10.x, 3.4.x or 3.2.x).

See https://www.open-mesh.org/issues/342 for more information.

Kind regards,
	Sven
  

Patch

diff --git a/compat-include/linux/netdevice.h b/compat-include/linux/netdevice.h
index 1b36e529..00ed5e40 100644
--- a/compat-include/linux/netdevice.h
+++ b/compat-include/linux/netdevice.h
@@ -86,7 +86,7 @@  static inline void batadv_netif_trans_update(struct net_device *dev)
 
 #endif /* < KERNEL_VERSION(4, 7, 0) */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 9)
 
 /* work around missing attribute needs_free_netdev and priv_destructor in
  * net_device
@@ -103,6 +103,6 @@  static inline void batadv_netif_trans_update(struct net_device *dev)
 #define needs_free_netdev destructor = batadv_softif_free2; t2
 #define priv_destructor destructor = batadv_softif_free2; t1
 
-#endif /* < KERNEL_VERSION(4, 12, 0) */
+#endif /* < KERNEL_VERSION(4, 11, 9) */
 
 #endif	/* _NET_BATMAN_ADV_COMPAT_LINUX_NETDEVICE_H_ */