diff options
author | Paul Moore <pmoore@redhat.com> | 2013-07-23 17:38:38 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2013-07-25 13:01:25 -0400 |
commit | 2e5aa86609ec1cf37bcc204fd7ba6c24c2f49fec (patch) | |
tree | dfe240f974ba5437143fa8869813ac634731d860 /security/security.c | |
parent | 8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff) |
lsm: split the xfrm_state_alloc_security() hook implementation
The xfrm_state_alloc_security() LSM hook implementation is really a
multiplexed hook with two different behaviors depending on the
arguments passed to it by the caller. This patch splits the LSM hook
implementation into two new hook implementations, which match the
LSM hooks in the rest of the kernel:
* xfrm_state_alloc
* xfrm_state_alloc_acquire
Also included in this patch are the necessary changes to the SELinux
code; no other LSMs are affected.
Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/security/security.c b/security/security.c index a3dce87d1aef..57e25c962968 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -1322,22 +1322,17 @@ int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) | |||
1322 | return security_ops->xfrm_policy_delete_security(ctx); | 1322 | return security_ops->xfrm_policy_delete_security(ctx); |
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) | 1325 | int security_xfrm_state_alloc(struct xfrm_state *x, |
1326 | struct xfrm_user_sec_ctx *sec_ctx) | ||
1326 | { | 1327 | { |
1327 | return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0); | 1328 | return security_ops->xfrm_state_alloc(x, sec_ctx); |
1328 | } | 1329 | } |
1329 | EXPORT_SYMBOL(security_xfrm_state_alloc); | 1330 | EXPORT_SYMBOL(security_xfrm_state_alloc); |
1330 | 1331 | ||
1331 | int security_xfrm_state_alloc_acquire(struct xfrm_state *x, | 1332 | int security_xfrm_state_alloc_acquire(struct xfrm_state *x, |
1332 | struct xfrm_sec_ctx *polsec, u32 secid) | 1333 | struct xfrm_sec_ctx *polsec, u32 secid) |
1333 | { | 1334 | { |
1334 | if (!polsec) | 1335 | return security_ops->xfrm_state_alloc_acquire(x, polsec, secid); |
1335 | return 0; | ||
1336 | /* | ||
1337 | * We want the context to be taken from secid which is usually | ||
1338 | * from the sock. | ||
1339 | */ | ||
1340 | return security_ops->xfrm_state_alloc_security(x, NULL, secid); | ||
1341 | } | 1336 | } |
1342 | 1337 | ||
1343 | int security_xfrm_state_delete(struct xfrm_state *x) | 1338 | int security_xfrm_state_delete(struct xfrm_state *x) |