Skip to content

Commit 6f799c9

Browse files
author
James Morris
committed
Merge branch 'master' of git://git.infradead.org/users/pcmoore/selinux into ra-next
2 parents eb8948a + 42d64e1 commit 6f799c9

17 files changed

Lines changed: 450 additions & 400 deletions

File tree

‎include/linux/security.h‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,17 +1052,25 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
10521052
* @xfrm_policy_delete_security:
10531053
* @ctx contains the xfrm_sec_ctx.
10541054
* Authorize deletion of xp->security.
1055-
* @xfrm_state_alloc_security:
1055+
* @xfrm_state_alloc:
10561056
* @x contains the xfrm_state being added to the Security Association
10571057
* Database by the XFRM system.
10581058
* @sec_ctx contains the security context information being provided by
10591059
* the user-level SA generation program (e.g., setkey or racoon).
1060-
* @secid contains the secid from which to take the mls portion of the context.
10611060
* Allocate a security structure to the x->security field; the security
10621061
* field is initialized to NULL when the xfrm_state is allocated. Set the
1063-
* context to correspond to either sec_ctx or polsec, with the mls portion
1064-
* taken from secid in the latter case.
1065-
* Return 0 if operation was successful (memory to allocate, legal context).
1062+
* context to correspond to sec_ctx. Return 0 if operation was successful
1063+
* (memory to allocate, legal context).
1064+
* @xfrm_state_alloc_acquire:
1065+
* @x contains the xfrm_state being added to the Security Association
1066+
* Database by the XFRM system.
1067+
* @polsec contains the policy's security context.
1068+
* @secid contains the secid from which to take the mls portion of the
1069+
* context.
1070+
* Allocate a security structure to the x->security field; the security
1071+
* field is initialized to NULL when the xfrm_state is allocated. Set the
1072+
* context to correspond to secid. Return 0 if operation was successful
1073+
* (memory to allocate, legal context).
10661074
* @xfrm_state_free_security:
10671075
* @x contains the xfrm_state.
10681076
* Deallocate x->security.
@@ -1679,9 +1687,11 @@ struct security_operations {
16791687
int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
16801688
void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
16811689
int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
1682-
int (*xfrm_state_alloc_security) (struct xfrm_state *x,
1683-
struct xfrm_user_sec_ctx *sec_ctx,
1684-
u32 secid);
1690+
int (*xfrm_state_alloc) (struct xfrm_state *x,
1691+
struct xfrm_user_sec_ctx *sec_ctx);
1692+
int (*xfrm_state_alloc_acquire) (struct xfrm_state *x,
1693+
struct xfrm_sec_ctx *polsec,
1694+
u32 secid);
16851695
void (*xfrm_state_free_security) (struct xfrm_state *x);
16861696
int (*xfrm_state_delete_security) (struct xfrm_state *x);
16871697
int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);

‎security/capability.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -777,9 +777,15 @@ static int cap_xfrm_policy_delete_security(struct xfrm_sec_ctx *ctx)
777777
return 0;
778778
}
779779

780-
static int cap_xfrm_state_alloc_security(struct xfrm_state *x,
781-
struct xfrm_user_sec_ctx *sec_ctx,
782-
u32 secid)
780+
static int cap_xfrm_state_alloc(struct xfrm_state *x,
781+
struct xfrm_user_sec_ctx *sec_ctx)
782+
{
783+
return 0;
784+
}
785+
786+
static int cap_xfrm_state_alloc_acquire(struct xfrm_state *x,
787+
struct xfrm_sec_ctx *polsec,
788+
u32 secid)
783789
{
784790
return 0;
785791
}
@@ -1101,7 +1107,8 @@ void __init security_fixup_ops(struct security_operations *ops)
11011107
set_to_cap_if_null(ops, xfrm_policy_clone_security);
11021108
set_to_cap_if_null(ops, xfrm_policy_free_security);
11031109
set_to_cap_if_null(ops, xfrm_policy_delete_security);
1104-
set_to_cap_if_null(ops, xfrm_state_alloc_security);
1110+
set_to_cap_if_null(ops, xfrm_state_alloc);
1111+
set_to_cap_if_null(ops, xfrm_state_alloc_acquire);
11051112
set_to_cap_if_null(ops, xfrm_state_free_security);
11061113
set_to_cap_if_null(ops, xfrm_state_delete_security);
11071114
set_to_cap_if_null(ops, xfrm_policy_lookup);

‎security/security.c‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,22 +1340,17 @@ int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
13401340
return security_ops->xfrm_policy_delete_security(ctx);
13411341
}
13421342

1343-
int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
1343+
int security_xfrm_state_alloc(struct xfrm_state *x,
1344+
struct xfrm_user_sec_ctx *sec_ctx)
13441345
{
1345-
return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0);
1346+
return security_ops->xfrm_state_alloc(x, sec_ctx);
13461347
}
13471348
EXPORT_SYMBOL(security_xfrm_state_alloc);
13481349

13491350
int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
13501351
struct xfrm_sec_ctx *polsec, u32 secid)
13511352
{
1352-
if (!polsec)
1353-
return 0;
1354-
/*
1355-
* We want the context to be taken from secid which is usually
1356-
* from the sock.
1357-
*/
1358-
return security_ops->xfrm_state_alloc_security(x, NULL, secid);
1353+
return security_ops->xfrm_state_alloc_acquire(x, polsec, secid);
13591354
}
13601355

13611356
int security_xfrm_state_delete(struct xfrm_state *x)

0 commit comments

Comments
 (0)