summaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
authorGaosheng Cui <cuigaosheng1@huawei.com>2021-10-16 15:23:50 +0800
committerPaul Moore <paul@paul-moore.com>2021-10-18 18:27:47 -0400
commit6e3ee990c90494561921c756481d0e2125d8b895 (patch)
treea51a15f661eca61335799a2bc4b898a6720e454c /kernel/auditsc.c
parent67d69e9d1a6c889d98951c1d74b19332ce0565af (diff)
downloadlinux-6e3ee990c90494561921c756481d0e2125d8b895.tar.bz2
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 <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 8dd73a64f921..b1cb1dbf7417 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;