]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
UBUNTU: SAUCE: Audit: Fix for missing NULL check
authorCasey Schaufler <casey@schaufler-ca.com>
Tue, 1 Sep 2020 18:19:11 +0000 (11:19 -0700)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 15 Feb 2021 07:26:02 +0000 (08:26 +0100)
AppArmor audit calls can have a NULL audit context,
so the LSM context audit needs to check for this.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
kernel/audit.c

index de69f2ab20224965ca827e30176ac97f5222a1f7..f8c4064db82892e7fd240e3a201543a59996e13a 100644 (file)
@@ -1891,7 +1891,8 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
        /* cancel dummy context to enable supporting records */
        if (ctx)
                ctx->dummy = 0;
-       if (type == AUDIT_MAC_TASK_CONTEXTS && ab->ctx->serial == 0) {
+       if (type == AUDIT_MAC_TASK_CONTEXTS && ab->ctx &&
+           ab->ctx->serial == 0) {
                audit_stamp_context(ab->ctx);
                audit_get_stamp(ab->ctx, &t, &serial);
        }