aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm/xfrm_user.c')
-rw-r--r--net/xfrm/xfrm_user.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d54b3a70d5df..c4cde57d9216 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -323,7 +323,7 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
323 x->props.replay_window = p->replay_window; 323 x->props.replay_window = p->replay_window;
324 x->props.reqid = p->reqid; 324 x->props.reqid = p->reqid;
325 x->props.family = p->family; 325 x->props.family = p->family;
326 x->props.saddr = p->saddr; 326 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr));
327 x->props.flags = p->flags; 327 x->props.flags = p->flags;
328} 328}
329 329
@@ -545,7 +545,7 @@ static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p)
545 memcpy(&p->lft, &x->lft, sizeof(p->lft)); 545 memcpy(&p->lft, &x->lft, sizeof(p->lft));
546 memcpy(&p->curlft, &x->curlft, sizeof(p->curlft)); 546 memcpy(&p->curlft, &x->curlft, sizeof(p->curlft));
547 memcpy(&p->stats, &x->stats, sizeof(p->stats)); 547 memcpy(&p->stats, &x->stats, sizeof(p->stats));
548 p->saddr = x->props.saddr; 548 memcpy(&p->saddr, &x->props.saddr, sizeof(p->saddr));
549 p->mode = x->props.mode; 549 p->mode = x->props.mode;
550 p->replay_window = x->props.replay_window; 550 p->replay_window = x->props.replay_window;
551 p->reqid = x->props.reqid; 551 p->reqid = x->props.reqid;
@@ -1927,6 +1927,9 @@ static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt,
1927 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); 1927 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
1928 len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire)); 1928 len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire));
1929 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); 1929 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp));
1930#ifdef CONFIG_XFRM_SUB_POLICY
1931 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
1932#endif
1930 skb = alloc_skb(len, GFP_ATOMIC); 1933 skb = alloc_skb(len, GFP_ATOMIC);
1931 if (skb == NULL) 1934 if (skb == NULL)
1932 return -ENOMEM; 1935 return -ENOMEM;
@@ -1992,15 +1995,6 @@ static struct xfrm_policy *xfrm_compile_policy(struct sock *sk, int opt,
1992 xp->type = XFRM_POLICY_TYPE_MAIN; 1995 xp->type = XFRM_POLICY_TYPE_MAIN;
1993 copy_templates(xp, ut, nr); 1996 copy_templates(xp, ut, nr);
1994 1997
1995 if (!xp->security) {
1996 int err = security_xfrm_sock_policy_alloc(xp, sk);
1997 if (err) {
1998 kfree(xp);
1999 *dir = err;
2000 return NULL;
2001 }
2002 }
2003
2004 *dir = p->dir; 1998 *dir = p->dir;
2005 1999
2006 return xp; 2000 return xp;
@@ -2043,6 +2037,9 @@ static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, struct km_eve
2043 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); 2037 len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
2044 len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire)); 2038 len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire));
2045 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); 2039 len += RTA_SPACE(xfrm_user_sec_ctx_size(xp));
2040#ifdef CONFIG_XFRM_SUB_POLICY
2041 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
2042#endif
2046 skb = alloc_skb(len, GFP_ATOMIC); 2043 skb = alloc_skb(len, GFP_ATOMIC);
2047 if (skb == NULL) 2044 if (skb == NULL)
2048 return -ENOMEM; 2045 return -ENOMEM;
@@ -2069,6 +2066,9 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *
2069 len += RTA_SPACE(headlen); 2066 len += RTA_SPACE(headlen);
2070 headlen = sizeof(*id); 2067 headlen = sizeof(*id);
2071 } 2068 }
2069#ifdef CONFIG_XFRM_SUB_POLICY
2070 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
2071#endif
2072 len += NLMSG_SPACE(headlen); 2072 len += NLMSG_SPACE(headlen);
2073 2073
2074 skb = alloc_skb(len, GFP_ATOMIC); 2074 skb = alloc_skb(len, GFP_ATOMIC);
@@ -2115,10 +2115,12 @@ static int xfrm_notify_policy_flush(struct km_event *c)
2115 struct nlmsghdr *nlh; 2115 struct nlmsghdr *nlh;
2116 struct sk_buff *skb; 2116 struct sk_buff *skb;
2117 unsigned char *b; 2117 unsigned char *b;
2118 int len = 0;
2118#ifdef CONFIG_XFRM_SUB_POLICY 2119#ifdef CONFIG_XFRM_SUB_POLICY
2119 struct xfrm_userpolicy_type upt; 2120 struct xfrm_userpolicy_type upt;
2121 len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
2120#endif 2122#endif
2121 int len = NLMSG_LENGTH(0); 2123 len += NLMSG_LENGTH(0);
2122 2124
2123 skb = alloc_skb(len, GFP_ATOMIC); 2125 skb = alloc_skb(len, GFP_ATOMIC);
2124 if (skb == NULL) 2126 if (skb == NULL)