]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - security/apparmor/lsm.c
Revert "UBUNTU: SAUCE: LSM stacking: add stacking support to apparmor network hooks"
[mirror_ubuntu-artful-kernel.git] / security / apparmor / lsm.c
index 792264c0ae1d8cf7c0da474fb0fd3545d9fdbe3f..8ccbf04d0cfcf85c5cf9cabdf393f8c35ff5ed0c 100644 (file)
@@ -748,7 +748,13 @@ static int apparmor_task_kill(struct task_struct *target, struct siginfo *info,
  */
 static int apparmor_sk_alloc_security(struct sock *sk, int family, gfp_t flags)
 {
-       /* allocated and cleared by LSM */
+       struct aa_sk_ctx *ctx;
+
+       ctx = kzalloc(sizeof(*ctx), flags);
+       if (!ctx)
+               return -ENOMEM;
+
+       SK_CTX(sk) = ctx;
 
        return 0;
 }
@@ -760,13 +766,11 @@ static void apparmor_sk_free_security(struct sock *sk)
 {
        struct aa_sk_ctx *ctx = SK_CTX(sk);
 
+       SK_CTX(sk) = NULL;
        aa_put_label(ctx->label);
-       ctx->label = NULL;
        aa_put_label(ctx->peer);
-       ctx->peer = NULL;
        path_put(&ctx->path);
-       ctx->path.dentry = NULL;
-       ctx->path.mnt = NULL;
+       kfree(ctx);
 }
 
 /**
@@ -1147,7 +1151,6 @@ static void apparmor_sock_graft(struct sock *sk, struct socket *parent)
 struct lsm_blob_sizes apparmor_blob_sizes = {
        .lbs_cred = sizeof(struct aa_task_ctx),
        .lbs_file = sizeof(struct aa_file_ctx),
-       .lbs_sock = sizeof(struct aa_sk_ctx),
 };
 
 static struct security_hook_list apparmor_hooks[] __lsm_ro_after_init = {