diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-30 11:35:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-30 11:35:35 -0400 |
commit | 847f877600313e65c5659476b30d74a6f66e388e (patch) | |
tree | b4390fb56dc3c9a47cb51f3a086515a376cffc0c /drivers | |
parent | 79346507ad48895f41b438fa562b1965721f36b9 (diff) | |
parent | 120a795da07c9a02221ca23464c28a7c6ad7de1d (diff) |
Merge branch 'audit.b64' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current
* 'audit.b64' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
audit mmap
audit: make link()/linkat() match "attribute change" predicate
audit: Use rcu for task lookup protection
audit: Do not send uninitialized data for AUDIT_TTY_GET
audit: Call tty_audit_push_task() outside preempt disabled
in untag_chunk() we need to do alloc_chunk() a bit earlier
audit: make functions static
Audit: add support to match lsm labels on user audit messages
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/tty_audit.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/char/tty_audit.c b/drivers/char/tty_audit.c index 1b8ee590b4ca..f64582b0f623 100644 --- a/drivers/char/tty_audit.c +++ b/drivers/char/tty_audit.c | |||
@@ -188,25 +188,43 @@ void tty_audit_tiocsti(struct tty_struct *tty, char ch) | |||
188 | } | 188 | } |
189 | 189 | ||
190 | /** | 190 | /** |
191 | * tty_audit_push_task - Flush task's pending audit data | 191 | * tty_audit_push_task - Flush task's pending audit data |
192 | * @tsk: task pointer | ||
193 | * @loginuid: sender login uid | ||
194 | * @sessionid: sender session id | ||
195 | * | ||
196 | * Called with a ref on @tsk held. Try to lock sighand and get a | ||
197 | * reference to the tty audit buffer if available. | ||
198 | * Flush the buffer or return an appropriate error code. | ||
192 | */ | 199 | */ |
193 | void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) | 200 | int tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) |
194 | { | 201 | { |
195 | struct tty_audit_buf *buf; | 202 | struct tty_audit_buf *buf = ERR_PTR(-EPERM); |
203 | unsigned long flags; | ||
196 | 204 | ||
197 | spin_lock_irq(&tsk->sighand->siglock); | 205 | if (!lock_task_sighand(tsk, &flags)) |
198 | buf = tsk->signal->tty_audit_buf; | 206 | return -ESRCH; |
199 | if (buf) | 207 | |
200 | atomic_inc(&buf->count); | 208 | if (tsk->signal->audit_tty) { |
201 | spin_unlock_irq(&tsk->sighand->siglock); | 209 | buf = tsk->signal->tty_audit_buf; |
202 | if (!buf) | 210 | if (buf) |
203 | return; | 211 | atomic_inc(&buf->count); |
212 | } | ||
213 | unlock_task_sighand(tsk, &flags); | ||
214 | |||
215 | /* | ||
216 | * Return 0 when signal->audit_tty set | ||
217 | * but tsk->signal->tty_audit_buf == NULL. | ||
218 | */ | ||
219 | if (!buf || IS_ERR(buf)) | ||
220 | return PTR_ERR(buf); | ||
204 | 221 | ||
205 | mutex_lock(&buf->mutex); | 222 | mutex_lock(&buf->mutex); |
206 | tty_audit_buf_push(tsk, loginuid, sessionid, buf); | 223 | tty_audit_buf_push(tsk, loginuid, sessionid, buf); |
207 | mutex_unlock(&buf->mutex); | 224 | mutex_unlock(&buf->mutex); |
208 | 225 | ||
209 | tty_audit_buf_put(buf); | 226 | tty_audit_buf_put(buf); |
227 | return 0; | ||
210 | } | 228 | } |
211 | 229 | ||
212 | /** | 230 | /** |