Messages in this thread Patch in this message | | | From | Dmitry Safonov <> | Subject | [PATCH 15/18] xfrm: Check compat acquire listeners in xfrm_is_alive() | Date | Thu, 26 Jul 2018 03:31:41 +0100 |
| |
As now there are two groups of listeners: XFRMNLGRP_ACQUIRE - applications that uses native UABI for messages; XFRMNLGRP_COMPAT_ACQUIRE - applications that uses compat UABI for messages;
So, both groups should be checked for listeners of acquire notifications.
Cc: "David S. Miller" <davem@davemloft.net> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Steffen Klassert <steffen.klassert@secunet.com> Cc: netdev@vger.kernel.org Signed-off-by: Dmitry Safonov <dima@arista.com> --- include/net/xfrm.h | 14 -------------- net/xfrm/xfrm_user.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 557122846e0e..c9b713017ae8 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1784,20 +1784,6 @@ static inline int xfrm_aevent_is_on(struct net *net) rcu_read_unlock(); return ret; } - -static inline int xfrm_acquire_is_on(struct net *net) -{ - struct sock *nlsk; - int ret = 0; - - rcu_read_lock(); - nlsk = rcu_dereference(net->xfrm.nlsk); - if (nlsk) - ret = netlink_has_listeners(nlsk, XFRMNLGRP_ACQUIRE); - rcu_read_unlock(); - - return ret; -} #endif static inline unsigned int aead_len(struct xfrm_algo_aead *alg) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 2fe6174b8a18..752019963b1e 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -3517,6 +3517,22 @@ static int xfrm_send_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_MAPPING); } +static inline int xfrm_acquire_is_on(struct net *net) +{ + struct sock *nlsk; + int ret = 0; + + rcu_read_lock(); + nlsk = rcu_dereference(net->xfrm.nlsk); + if (nlsk) + ret = netlink_has_listeners(nlsk, XFRMNLGRP_ACQUIRE); + if (!ret || IS_ENABLED(CONFIG_COMPAT)) + ret = netlink_has_listeners(nlsk, XFRMNLGRP_COMPAT_ACQUIRE); + rcu_read_unlock(); + + return ret; +} + static bool xfrm_is_alive(const struct km_event *c) { return (bool)xfrm_acquire_is_on(c->net); -- 2.13.6
| |