diff options
Diffstat (limited to 'kernel/auditsc.c')
| -rw-r--r-- | kernel/auditsc.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index c10e7aae04d7..972f8e61d36a 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
| @@ -243,6 +243,9 @@ static inline int open_arg(int flags, int mask) | |||
| 243 | 243 | ||
| 244 | static int audit_match_perm(struct audit_context *ctx, int mask) | 244 | static int audit_match_perm(struct audit_context *ctx, int mask) |
| 245 | { | 245 | { |
| 246 | if (unlikely(!ctx)) | ||
| 247 | return 0; | ||
| 248 | |||
| 246 | unsigned n = ctx->major; | 249 | unsigned n = ctx->major; |
| 247 | switch (audit_classify_syscall(ctx->arch, n)) { | 250 | switch (audit_classify_syscall(ctx->arch, n)) { |
| 248 | case 0: /* native */ | 251 | case 0: /* native */ |
| @@ -284,6 +287,10 @@ static int audit_match_filetype(struct audit_context *ctx, int which) | |||
| 284 | { | 287 | { |
| 285 | unsigned index = which & ~S_IFMT; | 288 | unsigned index = which & ~S_IFMT; |
| 286 | mode_t mode = which & S_IFMT; | 289 | mode_t mode = which & S_IFMT; |
| 290 | |||
| 291 | if (unlikely(!ctx)) | ||
| 292 | return 0; | ||
| 293 | |||
| 287 | if (index >= ctx->name_count) | 294 | if (index >= ctx->name_count) |
| 288 | return 0; | 295 | return 0; |
| 289 | if (ctx->names[index].ino == -1) | 296 | if (ctx->names[index].ino == -1) |
| @@ -610,7 +617,7 @@ static int audit_filter_rules(struct task_struct *tsk, | |||
| 610 | if (!result) | 617 | if (!result) |
| 611 | return 0; | 618 | return 0; |
| 612 | } | 619 | } |
| 613 | if (rule->filterkey) | 620 | if (rule->filterkey && ctx) |
| 614 | ctx->filterkey = kstrdup(rule->filterkey, GFP_ATOMIC); | 621 | ctx->filterkey = kstrdup(rule->filterkey, GFP_ATOMIC); |
| 615 | switch (rule->action) { | 622 | switch (rule->action) { |
| 616 | case AUDIT_NEVER: *state = AUDIT_DISABLED; break; | 623 | case AUDIT_NEVER: *state = AUDIT_DISABLED; break; |
| @@ -1476,7 +1483,8 @@ void audit_syscall_entry(int arch, int major, | |||
| 1476 | struct audit_context *context = tsk->audit_context; | 1483 | struct audit_context *context = tsk->audit_context; |
| 1477 | enum audit_state state; | 1484 | enum audit_state state; |
| 1478 | 1485 | ||
| 1479 | BUG_ON(!context); | 1486 | if (unlikely(!context)) |
| 1487 | return; | ||
| 1480 | 1488 | ||
| 1481 | /* | 1489 | /* |
| 1482 | * This happens only on certain architectures that make system | 1490 | * This happens only on certain architectures that make system |
| @@ -2374,7 +2382,7 @@ int __audit_signal_info(int sig, struct task_struct *t) | |||
| 2374 | struct audit_context *ctx = tsk->audit_context; | 2382 | struct audit_context *ctx = tsk->audit_context; |
| 2375 | 2383 | ||
| 2376 | if (audit_pid && t->tgid == audit_pid) { | 2384 | if (audit_pid && t->tgid == audit_pid) { |
| 2377 | if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1) { | 2385 | if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1 || sig == SIGUSR2) { |
| 2378 | audit_sig_pid = tsk->pid; | 2386 | audit_sig_pid = tsk->pid; |
| 2379 | if (tsk->loginuid != -1) | 2387 | if (tsk->loginuid != -1) |
| 2380 | audit_sig_uid = tsk->loginuid; | 2388 | audit_sig_uid = tsk->loginuid; |
