Alan,
I am not sure if you got my last email, so I'm resending it now:
> I am very sorry, but I don't see it. We didn't held the lock while
calling tty_audit_push() before, and we don't hold it after the patch
neither.
> So what's the locking scheme change here? Is there some binding
between n_tty_read() and tty_audit_push() I just don't see?
Please can you advice me why I should check this patch with audit folks?
Thanks a lot,
-Stanislav
>> Looks good to me. However it changes the locking rules on
>> tty_audit_push() so please check the audit folks are ok with it. I don't
>> think that causes any problems.
>>
>> Alan
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index ee1c268..54d1fc5 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1832,13 +1832,13 @@ do_it_again:
if (tty->icanon && !L_EXTPROC(tty)) {
/* N.B. avoid overrun if nr == 0 */
+ spin_lock_irqsave(&tty->read_lock, flags);
while (nr && tty->read_cnt) {
int eol;
eol = test_and_clear_bit(tty->read_tail,
tty->read_flags);
c = tty->read_buf[tty->read_tail];
- spin_lock_irqsave(&tty->read_lock, flags);
tty->read_tail = ((tty->read_tail+1) &
(N_TTY_BUF_SIZE-1));
tty->read_cnt--;
@@ -1864,6 +1864,7 @@ do_it_again:
tty_audit_push(tty);
break;
}
+ spin_lock_irqsave(&tty->read_lock, flags);
}
if (retval)
break;