summaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorRichard Guy Briggs <rgb@redhat.com>2016-06-28 18:07:50 +0200
committerPaul Moore <paul@paul-moore.com>2016-06-28 21:48:48 +0200
commit3f5be2da8565c1cce5655bb0948fcc957c6eb6c6 (patch)
tree114b88bf2c039380ce333b5bca2265ebf9c4fa8c /kernel/audit.c
parentaudit: move calcs after alloc and check when logging set loginuid (diff)
downloadlinux-3f5be2da8565c1cce5655bb0948fcc957c6eb6c6.tar.xz
linux-3f5be2da8565c1cce5655bb0948fcc957c6eb6c6.zip
audit: move audit_get_tty to reduce scope and kabi changes
The only users of audit_get_tty and audit_put_tty are internal to audit, so move it out of include/linux/audit.h to kernel.h and create a proper function rather than inlining it. This also reduces kABI changes. Suggested-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Richard Guy Briggs <rgb@redhat.com> [PM: line wrapped description] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 384374a1d232..d5971010e44a 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1866,6 +1866,23 @@ out_null:
audit_log_format(ab, " exe=(null)");
}
+struct tty_struct *audit_get_tty(struct task_struct *tsk)
+{
+ struct tty_struct *tty = NULL;
+ unsigned long flags;
+
+ spin_lock_irqsave(&tsk->sighand->siglock, flags);
+ if (tsk->signal)
+ tty = tty_kref_get(tsk->signal->tty);
+ spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
+ return tty;
+}
+
+void audit_put_tty(struct tty_struct *tty)
+{
+ tty_kref_put(tty);
+}
+
void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
{
const struct cred *cred;