Re: [PATCH] Fix race/oops in tty layer after BKL pushdown

From: Alan Cox
Date: Thu Aug 07 2008 - 16:04:33 EST


> It seems that tty was already free in disassocate_ctty when it tries
> to dereference tty->driver.
>
> After moving the lock_kernel before the mutex_unlock, I can no longer
> reproduce the problem.
>
> Please review and consider to apply:

This doesn't help as the BKL doesn't protect tty here - we don't have
refcounting on the ttys yet so this bug (which goes back forever) simply
becomes a different sized race if you swap the lock ordering.

Given tty_vhangup just fires off a wait queue which is killed on the tty
destruction you should be able for now at least to move the mutex_unlock
to after the call to tty_vhangup().

Does that also fix the problem ?

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/