audit: move audit_get_tty to reduce scope and kabi changes
[deliverable/linux.git] / kernel / audit.c
index 384374a1d232edcec9a2afc5a85693ade95196aa..d5971010e44a2616c1f59c703425a91e6b8f67ed 100644 (file)
@@ -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;
This page took 0.140196 seconds and 5 git commands to generate.