fix oops in __audit_signal_info()

The check for audit_signals is misplaced and the check for
audit_dummy_context() is missing; as the result, if we send a signal to
auditd from task with NULL ->audit_context while we have audit_signals
!= 0 we end up with an oops.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Al Viro 2007-08-08 00:01:46 +01:00 коммит произвёл Linus Torvalds
Родитель 9dc83afdbe
Коммит 175fc48425
1 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -1992,8 +1992,8 @@ int __audit_signal_info(int sig, struct task_struct *t)
extern uid_t audit_sig_uid;
extern u32 audit_sig_sid;
if (audit_pid && t->tgid == audit_pid &&
(sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1)) {
if (audit_pid && t->tgid == audit_pid) {
if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1) {
audit_sig_pid = tsk->pid;
if (ctx)
audit_sig_uid = ctx->loginuid;
@ -2001,9 +2001,9 @@ int __audit_signal_info(int sig, struct task_struct *t)
audit_sig_uid = tsk->uid;
selinux_get_task_sid(tsk, &audit_sig_sid);
}
if (!audit_signals) /* audit_context checked in wrapper */
if (!audit_signals || audit_dummy_context())
return 0;
}
/* optimize the common case by putting first signal recipient directly
* in audit_context */