diff options
author | Johannes Berg <johannes.berg@intel.com> | 2017-10-24 16:08:48 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2017-10-24 16:08:48 +0200 |
commit | 0d4503988a997e6414d1bf074c9a6fc62a7b339c (patch) | |
tree | 2f27a861a2e015103ed42776beb7b96a634cdc9e /backport | |
parent | 60f18ada41ef32e0554b4c7056d3868bcaa515be (diff) |
backports: fix the extack backport
I neglected to take into account that the spatch will also
be applied to the backport-4.12.c file itself, fix that.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'backport')
-rw-r--r-- | backport/backport-include/linux/netlink.h | 2 | ||||
-rw-r--r-- | backport/backport-include/net/genetlink.h | 11 | ||||
-rw-r--r-- | backport/compat/backport-4.12.c | 26 |
3 files changed, 25 insertions, 14 deletions
diff --git a/backport/backport-include/linux/netlink.h b/backport/backport-include/linux/netlink.h index 44359918..7da31aad 100644 --- a/backport/backport-include/linux/netlink.h +++ b/backport/backport-include/linux/netlink.h @@ -13,7 +13,7 @@ struct netlink_ext_ack { u8 cookie_len; /* backport only field */ - const void *__bp_genl_real_ops; + void *__bp_genl_real_ops; }; #define NL_SET_ERR_MSG(extack, msg) do { \ diff --git a/backport/backport-include/net/genetlink.h b/backport/backport-include/net/genetlink.h index 65a4a4b2..f620b99d 100644 --- a/backport/backport-include/net/genetlink.h +++ b/backport/backport-include/net/genetlink.h @@ -3,6 +3,17 @@ #include_next <net/genetlink.h> #include <linux/version.h> +static inline void __bp_genl_info_userhdr_set(struct genl_info *info, + void *userhdr) +{ + info->userhdr = userhdr; +} + +static inline void *__bp_genl_info_userhdr(struct genl_info *info) +{ + return info->userhdr; +} + #if LINUX_VERSION_IS_LESS(4,12,0) #define GENL_SET_ERR_MSG(info, msg) do { } while (0) diff --git a/backport/compat/backport-4.12.c b/backport/compat/backport-4.12.c index 73973bca..382a3af4 100644 --- a/backport/compat/backport-4.12.c +++ b/backport/compat/backport-4.12.c @@ -25,7 +25,7 @@ struct bp_extack_genl_family { static const struct nla_policy extack_dummy_policy[1] = {}; -static struct bp_extack_genl_family *get_copy(const struct genl_ops *op) +static struct bp_extack_genl_family *get_copy(__genl_const struct genl_ops *op) { do { op--; @@ -34,23 +34,23 @@ static struct bp_extack_genl_family *get_copy(const struct genl_ops *op) return container_of(op, struct bp_extack_genl_family, ops[0]); } -static int extack_pre_doit(const struct genl_ops *ops, +static int extack_pre_doit(__genl_const struct genl_ops *ops, struct sk_buff *skb, struct genl_info *info) { struct netlink_ext_ack *extack = kzalloc(sizeof(*extack), GFP_KERNEL); struct bp_extack_genl_family *copy = get_copy(ops); - const struct genl_ops *real_ops; + struct genl_ops *real_ops; int err; - info->userhdr = extack; + __bp_genl_info_userhdr_set(info, extack); if (!extack) { - info->userhdr = ERR_PTR(-ENOMEM); + __bp_genl_info_userhdr_set(info, ERR_PTR(-ENOMEM)); return -ENOMEM; } - real_ops = ©->real_family->ops[ops - ©->ops[1]]; + real_ops = (void *)©->real_family->ops[ops - ©->ops[1]]; extack->__bp_genl_real_ops = real_ops; if (copy->real_family->pre_doit) @@ -59,7 +59,7 @@ static int extack_pre_doit(const struct genl_ops *ops, err = 0; if (err) { - info->userhdr = ERR_PTR(err); + __bp_genl_info_userhdr_set(info, ERR_PTR(err)); kfree(extack); } @@ -144,13 +144,13 @@ static void extack_netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, static int extack_doit(struct sk_buff *skb, struct genl_info *info) { - const struct genl_ops *real_ops; + struct genl_ops *real_ops; int err; /* older kernels have a bug here */ - if (IS_ERR(info->userhdr)) { + if (IS_ERR(__bp_genl_info_userhdr(info))) { extack_netlink_ack(skb, info->nlhdr, - PTR_ERR(info->userhdr), + PTR_ERR(__bp_genl_info_userhdr(info)), genl_info_extack(info)); goto out; } @@ -171,11 +171,11 @@ out: return 0; } -static void extack_post_doit(const struct genl_ops *ops, +static void extack_post_doit(__genl_const struct genl_ops *ops, struct sk_buff *skb, struct genl_info *info) { - void (*post_doit)(const struct genl_ops *ops, + void (*post_doit)(__genl_const struct genl_ops *ops, struct sk_buff *skb, struct genl_info *info); @@ -183,7 +183,7 @@ static void extack_post_doit(const struct genl_ops *ops, if (post_doit) post_doit(ops, skb, info); - kfree(info->userhdr); + kfree(__bp_genl_info_userhdr(info)); } int bp_extack_genl_register_family(struct genl_family *family) |