Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1383828
| From | Paul Moore <paul@paul-moore.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V2] audit: add tty field to LOGIN event |
| Date | 2016-04-21 03:50 +0200 |
| Message-ID | <rqbUK-S0-3@gated-at.bofh.it> (permalink) |
| References | <rq9SW-7NA-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Apr 20, 2016 at 7:31 PM, Richard Guy Briggs <rgb@redhat.com> wrote:
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index b40ed5d..b00beef 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -26,6 +26,7 @@
> #include <linux/sched.h>
> #include <linux/ptrace.h>
> #include <uapi/linux/audit.h>
> +#include <linux/tty.h>
>
> #define AUDIT_INO_UNSET ((unsigned long)-1)
> #define AUDIT_DEV_UNSET ((dev_t)-1)
> @@ -343,6 +344,18 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
> return tsk->sessionid;
> }
>
> +static inline 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;
> +}
I'll look at this patch closer tomorrow, but one thing jumped out at
me just now: we should probably have a audit_put_tty(...) to match the
audit_get_tty(...). It seems more obvious than trying to match
audit_get_tty() and tty_kref_put() in a function.
--
paul moore
www.paul-moore.com
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH V2] audit: add tty field to LOGIN event Richard Guy Briggs <rgb@redhat.com> - 2016-04-21 01:40 +0200 Re: [PATCH V2] audit: add tty field to LOGIN event Paul Moore <paul@paul-moore.com> - 2016-04-21 03:50 +0200
csiph-web