aboutsummaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-03-25 20:29:20 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-25 20:29:20 -0400
commit04f58c88542b6b351efb4eea01134eb672e22e6e (patch)
tree47bb617212f8c8951f35730e324bdc43487a01ca /net/key
parent0fc31966035d7a540c011b6c967ce8eae1db121b (diff)
parent632b06aa2842b12c6d6a510ec080fb6ebdb38ea5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: Documentation/devicetree/bindings/net/micrel-ks8851.txt net/core/netpoll.c The net/core/netpoll.c conflict is a bug fix in 'net' happening to code which is completely removed in 'net-next'. In micrel-ks8851.txt we simply have overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/key')
-rw-r--r--net/key/af_key.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 12651b42aad8..e72589a8400d 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -434,12 +434,13 @@ static inline int verify_sec_ctx_len(const void *p)
434 return 0; 434 return 0;
435} 435}
436 436
437static inline struct xfrm_user_sec_ctx *pfkey_sadb2xfrm_user_sec_ctx(const struct sadb_x_sec_ctx *sec_ctx) 437static inline struct xfrm_user_sec_ctx *pfkey_sadb2xfrm_user_sec_ctx(const struct sadb_x_sec_ctx *sec_ctx,
438 gfp_t gfp)
438{ 439{
439 struct xfrm_user_sec_ctx *uctx = NULL; 440 struct xfrm_user_sec_ctx *uctx = NULL;
440 int ctx_size = sec_ctx->sadb_x_ctx_len; 441 int ctx_size = sec_ctx->sadb_x_ctx_len;
441 442
442 uctx = kmalloc((sizeof(*uctx)+ctx_size), GFP_KERNEL); 443 uctx = kmalloc((sizeof(*uctx)+ctx_size), gfp);
443 444
444 if (!uctx) 445 if (!uctx)
445 return NULL; 446 return NULL;
@@ -1125,7 +1126,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
1125 1126
1126 sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; 1127 sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1];
1127 if (sec_ctx != NULL) { 1128 if (sec_ctx != NULL) {
1128 struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); 1129 struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_KERNEL);
1129 1130
1130 if (!uctx) 1131 if (!uctx)
1131 goto out; 1132 goto out;
@@ -2249,14 +2250,14 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_
2249 2250
2250 sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; 2251 sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1];
2251 if (sec_ctx != NULL) { 2252 if (sec_ctx != NULL) {
2252 struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); 2253 struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_KERNEL);
2253 2254
2254 if (!uctx) { 2255 if (!uctx) {
2255 err = -ENOBUFS; 2256 err = -ENOBUFS;
2256 goto out; 2257 goto out;
2257 } 2258 }
2258 2259
2259 err = security_xfrm_policy_alloc(&xp->security, uctx); 2260 err = security_xfrm_policy_alloc(&xp->security, uctx, GFP_KERNEL);
2260 kfree(uctx); 2261 kfree(uctx);
2261 2262
2262 if (err) 2263 if (err)
@@ -2353,12 +2354,12 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa
2353 2354
2354 sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; 2355 sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1];
2355 if (sec_ctx != NULL) { 2356 if (sec_ctx != NULL) {
2356 struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); 2357 struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_KERNEL);
2357 2358
2358 if (!uctx) 2359 if (!uctx)
2359 return -ENOMEM; 2360 return -ENOMEM;
2360 2361
2361 err = security_xfrm_policy_alloc(&pol_ctx, uctx); 2362 err = security_xfrm_policy_alloc(&pol_ctx, uctx, GFP_KERNEL);
2362 kfree(uctx); 2363 kfree(uctx);
2363 if (err) 2364 if (err)
2364 return err; 2365 return err;
@@ -3275,8 +3276,8 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
3275 } 3276 }
3276 if ((*dir = verify_sec_ctx_len(p))) 3277 if ((*dir = verify_sec_ctx_len(p)))
3277 goto out; 3278 goto out;
3278 uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); 3279 uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_ATOMIC);
3279 *dir = security_xfrm_policy_alloc(&xp->security, uctx); 3280 *dir = security_xfrm_policy_alloc(&xp->security, uctx, GFP_ATOMIC);
3280 kfree(uctx); 3281 kfree(uctx);
3281 3282
3282 if (*dir) 3283 if (*dir)