From: Gaosheng Cui Date: Sat, 16 Oct 2021 07:23:50 +0000 (+0800) Subject: audit: fix possible null-pointer dereference in audit_filter_rules X-Git-Tag: v5.15~53^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e3ee990c90494561921c756481d0e2125d8b895;p=platform%2Fkernel%2Flinux-starfive.git audit: fix possible null-pointer dereference in audit_filter_rules Fix possible null-pointer dereference in audit_filter_rules. audit_filter_rules() error: we previously assumed 'ctx' could be null Cc: stable@vger.kernel.org Fixes: bf361231c295 ("audit: add saddr_fam filter field") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Gaosheng Cui Signed-off-by: Paul Moore --- diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 8dd73a6..b1cb1db 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -657,7 +657,7 @@ static int audit_filter_rules(struct task_struct *tsk, result = audit_comparator(audit_loginuid_set(tsk), f->op, f->val); break; case AUDIT_SADDR_FAM: - if (ctx->sockaddr) + if (ctx && ctx->sockaddr) result = audit_comparator(ctx->sockaddr->ss_family, f->op, f->val); break;