aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-06-04 02:32:12 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-04 02:32:12 -0400
commitc99f7abf0e69987e4add567e155e042cb1f2a20b (patch)
treed23898dc30ed25c1dae9bb6325041027d412397a /net/xfrm
parent92ff71b8fe9cd9c673615fc6f3870af7376d7c84 (diff)
parentd8b0426af5b67973585712c9af36b86f6ea97815 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: include/net/inetpeer.h net/ipv6/output_core.c Changes in net were fixing bugs in code removed in net-next. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_user.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index fd9a16a6d1de..412d9dc3a873 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -947,6 +947,20 @@ static struct sk_buff *xfrm_state_netlink(struct sk_buff *in_skb,
947 return skb; 947 return skb;
948} 948}
949 949
950/* A wrapper for nlmsg_multicast() checking that nlsk is still available.
951 * Must be called with RCU read lock.
952 */
953static inline int xfrm_nlmsg_multicast(struct net *net, struct sk_buff *skb,
954 u32 pid, unsigned int group)
955{
956 struct sock *nlsk = rcu_dereference(net->xfrm.nlsk);
957
958 if (nlsk)
959 return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC);
960 else
961 return -1;
962}
963
950static inline size_t xfrm_spdinfo_msgsize(void) 964static inline size_t xfrm_spdinfo_msgsize(void)
951{ 965{
952 return NLMSG_ALIGN(4) 966 return NLMSG_ALIGN(4)
@@ -2228,7 +2242,7 @@ static int xfrm_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
2228 if (build_migrate(skb, m, num_migrate, k, sel, dir, type) < 0) 2242 if (build_migrate(skb, m, num_migrate, k, sel, dir, type) < 0)
2229 BUG(); 2243 BUG();
2230 2244
2231 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_MIGRATE, GFP_ATOMIC); 2245 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_MIGRATE);
2232} 2246}
2233#else 2247#else
2234static int xfrm_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, 2248static int xfrm_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
@@ -2419,7 +2433,7 @@ static int xfrm_exp_state_notify(struct xfrm_state *x, const struct km_event *c)
2419 return -EMSGSIZE; 2433 return -EMSGSIZE;
2420 } 2434 }
2421 2435
2422 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_EXPIRE, GFP_ATOMIC); 2436 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_EXPIRE);
2423} 2437}
2424 2438
2425static int xfrm_aevent_state_notify(struct xfrm_state *x, const struct km_event *c) 2439static int xfrm_aevent_state_notify(struct xfrm_state *x, const struct km_event *c)
@@ -2434,7 +2448,7 @@ static int xfrm_aevent_state_notify(struct xfrm_state *x, const struct km_event
2434 if (build_aevent(skb, x, c) < 0) 2448 if (build_aevent(skb, x, c) < 0)
2435 BUG(); 2449 BUG();
2436 2450
2437 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_AEVENTS, GFP_ATOMIC); 2451 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_AEVENTS);
2438} 2452}
2439 2453
2440static int xfrm_notify_sa_flush(const struct km_event *c) 2454static int xfrm_notify_sa_flush(const struct km_event *c)
@@ -2460,7 +2474,7 @@ static int xfrm_notify_sa_flush(const struct km_event *c)
2460 2474
2461 nlmsg_end(skb, nlh); 2475 nlmsg_end(skb, nlh);
2462 2476
2463 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_SA, GFP_ATOMIC); 2477 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_SA);
2464} 2478}
2465 2479
2466static inline size_t xfrm_sa_len(struct xfrm_state *x) 2480static inline size_t xfrm_sa_len(struct xfrm_state *x)
@@ -2547,7 +2561,7 @@ static int xfrm_notify_sa(struct xfrm_state *x, const struct km_event *c)
2547 2561
2548 nlmsg_end(skb, nlh); 2562 nlmsg_end(skb, nlh);
2549 2563
2550 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_SA, GFP_ATOMIC); 2564 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_SA);
2551 2565
2552out_free_skb: 2566out_free_skb:
2553 kfree_skb(skb); 2567 kfree_skb(skb);
@@ -2638,7 +2652,7 @@ static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt,
2638 if (build_acquire(skb, x, xt, xp) < 0) 2652 if (build_acquire(skb, x, xt, xp) < 0)
2639 BUG(); 2653 BUG();
2640 2654
2641 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_ACQUIRE, GFP_ATOMIC); 2655 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_ACQUIRE);
2642} 2656}
2643 2657
2644/* User gives us xfrm_user_policy_info followed by an array of 0 2658/* User gives us xfrm_user_policy_info followed by an array of 0
@@ -2752,7 +2766,7 @@ static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, const struct
2752 if (build_polexpire(skb, xp, dir, c) < 0) 2766 if (build_polexpire(skb, xp, dir, c) < 0)
2753 BUG(); 2767 BUG();
2754 2768
2755 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_EXPIRE, GFP_ATOMIC); 2769 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_EXPIRE);
2756} 2770}
2757 2771
2758static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, const struct km_event *c) 2772static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, const struct km_event *c)
@@ -2814,7 +2828,7 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, const struct km_e
2814 2828
2815 nlmsg_end(skb, nlh); 2829 nlmsg_end(skb, nlh);
2816 2830
2817 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_POLICY, GFP_ATOMIC); 2831 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_POLICY);
2818 2832
2819out_free_skb: 2833out_free_skb:
2820 kfree_skb(skb); 2834 kfree_skb(skb);
@@ -2842,7 +2856,7 @@ static int xfrm_notify_policy_flush(const struct km_event *c)
2842 2856
2843 nlmsg_end(skb, nlh); 2857 nlmsg_end(skb, nlh);
2844 2858
2845 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_POLICY, GFP_ATOMIC); 2859 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_POLICY);
2846 2860
2847out_free_skb: 2861out_free_skb:
2848 kfree_skb(skb); 2862 kfree_skb(skb);
@@ -2911,7 +2925,7 @@ static int xfrm_send_report(struct net *net, u8 proto,
2911 if (build_report(skb, proto, sel, addr) < 0) 2925 if (build_report(skb, proto, sel, addr) < 0)
2912 BUG(); 2926 BUG();
2913 2927
2914 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_REPORT, GFP_ATOMIC); 2928 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_REPORT);
2915} 2929}
2916 2930
2917static inline size_t xfrm_mapping_msgsize(void) 2931static inline size_t xfrm_mapping_msgsize(void)
@@ -2963,7 +2977,7 @@ static int xfrm_send_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr,
2963 if (build_mapping(skb, x, ipaddr, sport) < 0) 2977 if (build_mapping(skb, x, ipaddr, sport) < 0)
2964 BUG(); 2978 BUG();
2965 2979
2966 return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_MAPPING, GFP_ATOMIC); 2980 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_MAPPING);
2967} 2981}
2968 2982
2969static bool xfrm_is_alive(const struct km_event *c) 2983static bool xfrm_is_alive(const struct km_event *c)