batman-adv: Deactivate __ro_after_init for kernels < 4.10

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

Commit Message

Sven Eckelmann Nov. 1, 2016, 6:17 a.m. UTC
  The pre-4.10 kernels must write to batadv_netlink_family after the family
was registered. Thus disabling __ro_after_init for now is required on these
kernels.

Fixes: c776b4a071d8 ("batman-adv: genetlink: mark families as __ro_after_init")
Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 compat-include/linux/cache.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

Linus Lüssing Nov. 1, 2016, 7:12 a.m. UTC | #1
On Tue, Nov 01, 2016 at 07:17:50AM +0100, Sven Eckelmann wrote:
> The pre-4.10 kernels must write to batadv_netlink_family after the family
> was registered. Thus disabling __ro_after_init for now is required on these
> kernels.
> 
> Fixes: c776b4a071d8 ("batman-adv: genetlink: mark families as __ro_after_init")
> Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---

That seems to work, thanks! :)

Tested-by: Linus Lüssing <linus.luessing@c0d3.blue>
  
Sven Eckelmann Nov. 1, 2016, 7:32 a.m. UTC | #2
On Dienstag, 1. November 2016 07:17:50 CET Sven Eckelmann wrote:
> The pre-4.10 kernels must write to batadv_netlink_family after the family
> was registered. Thus disabling __ro_after_init for now is required on these
> kernels.
> 
> Fixes: c776b4a071d8 ("batman-adv: genetlink: mark families as __ro_after_init")
> Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Tested-by: Linus Lüssing <linus.luessing@c0d3.blue>
> ---
>  compat-include/linux/cache.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Applied in 83e3cb32617d07a33fb43faa0957b91b3ac622c5 [1].

Kind regards,
        Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/83e3cb32617d07a33fb43faa0957b91b3ac622c5
  

Patch

diff --git a/compat-include/linux/cache.h b/compat-include/linux/cache.h
index 93dff58..7b7069a 100644
--- a/compat-include/linux/cache.h
+++ b/compat-include/linux/cache.h
@@ -24,11 +24,13 @@ 
 #include <linux/version.h>
 #include_next <linux/cache.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
 
-#ifndef __ro_after_init
-#define __ro_after_init
+/* hack for netlink.c which marked the family ops as ro */
+#ifdef __ro_after_init
+#undef __ro_after_init
 #endif
+#define __ro_after_init
 
 #endif /* < KERNEL_VERSION(4, 6, 0) */