diff options
author | David S. Miller <davem@davemloft.net> | 2013-06-05 18:56:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-05 19:37:30 -0400 |
commit | 6bc19fb82d4c05a9eee19d6d2aab2ce26e499ec2 (patch) | |
tree | 8b049ef383307f5dae91b5c9cf78dbfb9b74a4d1 /security/selinux | |
parent | 11a164a04382d735230b01f4cc46ad78a7c4abf6 (diff) | |
parent | 4d3797d7e1861ac1af150a6189315786c5e1c820 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Merge 'net' bug fixes into 'net-next' as we have patches
that will build on top of them.
This merge commit includes a change from Emil Goode
(emilgoode@gmail.com) that fixes a warning that would
have been introduced by this merge. Specifically it
fixes the pingv6_ops method ipv6_chk_addr() to add a
"const" to the "struct net_device *dev" argument and
likewise update the dummy_ipv6_chk_addr() declaration.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/xfrm.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c index 8ab295154517..d03081886214 100644 --- a/security/selinux/xfrm.c +++ b/security/selinux/xfrm.c | |||
@@ -316,6 +316,7 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, | |||
316 | 316 | ||
317 | memcpy(new_ctx, old_ctx, sizeof(*new_ctx)); | 317 | memcpy(new_ctx, old_ctx, sizeof(*new_ctx)); |
318 | memcpy(new_ctx->ctx_str, old_ctx->ctx_str, new_ctx->ctx_len); | 318 | memcpy(new_ctx->ctx_str, old_ctx->ctx_str, new_ctx->ctx_len); |
319 | atomic_inc(&selinux_xfrm_refcount); | ||
319 | *new_ctxp = new_ctx; | 320 | *new_ctxp = new_ctx; |
320 | } | 321 | } |
321 | return 0; | 322 | return 0; |
@@ -326,6 +327,7 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, | |||
326 | */ | 327 | */ |
327 | void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx) | 328 | void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx) |
328 | { | 329 | { |
330 | atomic_dec(&selinux_xfrm_refcount); | ||
329 | kfree(ctx); | 331 | kfree(ctx); |
330 | } | 332 | } |
331 | 333 | ||
@@ -335,17 +337,13 @@ void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx) | |||
335 | int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) | 337 | int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) |
336 | { | 338 | { |
337 | const struct task_security_struct *tsec = current_security(); | 339 | const struct task_security_struct *tsec = current_security(); |
338 | int rc = 0; | ||
339 | 340 | ||
340 | if (ctx) { | 341 | if (!ctx) |
341 | rc = avc_has_perm(tsec->sid, ctx->ctx_sid, | 342 | return 0; |
342 | SECCLASS_ASSOCIATION, | ||
343 | ASSOCIATION__SETCONTEXT, NULL); | ||
344 | if (rc == 0) | ||
345 | atomic_dec(&selinux_xfrm_refcount); | ||
346 | } | ||
347 | 343 | ||
348 | return rc; | 344 | return avc_has_perm(tsec->sid, ctx->ctx_sid, |
345 | SECCLASS_ASSOCIATION, ASSOCIATION__SETCONTEXT, | ||
346 | NULL); | ||
349 | } | 347 | } |
350 | 348 | ||
351 | /* | 349 | /* |
@@ -370,8 +368,8 @@ int selinux_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *uct | |||
370 | */ | 368 | */ |
371 | void selinux_xfrm_state_free(struct xfrm_state *x) | 369 | void selinux_xfrm_state_free(struct xfrm_state *x) |
372 | { | 370 | { |
373 | struct xfrm_sec_ctx *ctx = x->security; | 371 | atomic_dec(&selinux_xfrm_refcount); |
374 | kfree(ctx); | 372 | kfree(x->security); |
375 | } | 373 | } |
376 | 374 | ||
377 | /* | 375 | /* |
@@ -381,17 +379,13 @@ int selinux_xfrm_state_delete(struct xfrm_state *x) | |||
381 | { | 379 | { |
382 | const struct task_security_struct *tsec = current_security(); | 380 | const struct task_security_struct *tsec = current_security(); |
383 | struct xfrm_sec_ctx *ctx = x->security; | 381 | struct xfrm_sec_ctx *ctx = x->security; |
384 | int rc = 0; | ||
385 | 382 | ||
386 | if (ctx) { | 383 | if (!ctx) |
387 | rc = avc_has_perm(tsec->sid, ctx->ctx_sid, | 384 | return 0; |
388 | SECCLASS_ASSOCIATION, | ||
389 | ASSOCIATION__SETCONTEXT, NULL); | ||
390 | if (rc == 0) | ||
391 | atomic_dec(&selinux_xfrm_refcount); | ||
392 | } | ||
393 | 385 | ||
394 | return rc; | 386 | return avc_has_perm(tsec->sid, ctx->ctx_sid, |
387 | SECCLASS_ASSOCIATION, ASSOCIATION__SETCONTEXT, | ||
388 | NULL); | ||
395 | } | 389 | } |
396 | 390 | ||
397 | /* | 391 | /* |