Commit 06ce414d authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

6pack,mkiss: fix lock inconsistency

commit 6e4e2f81 upstream.

Lockdep found a locking inconsistency in the mkiss_close function:

> kernel: [ INFO: inconsistent lock state ]
> kernel: 2.6.39.1 #3
> kernel: ---------------------------------
> kernel: inconsistent {IN-SOFTIRQ-R} -> {SOFTIRQ-ON-W} usage.
> kernel: ax25ipd/2813 [HC0[0]:SC0[0]:HE1:SE1] takes:
> kernel: (disc_data_lock){+++?.-}, at: [<ffffffffa018552b>] mkiss_close+0x1b/0x90 [mkiss]
> kernel: {IN-SOFTIRQ-R} state was registered at:

The message hints that disc_data_lock is aquired with softirqs disabled,
but does not itself disable softirqs, which can in rare circumstances
lead to a deadlock.
The same problem is present in the 6pack driver, this patch fixes both
by using write_lock_bh instead of write_lock.
Reported-by: default avatarBernard F6BVP <f6bvp@free.fr>
Tested-by: default avatarBernard F6BVP <f6bvp@free.fr>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: Ralf Baechle<ralf@linux-mips.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d2c7e885
......@@ -690,10 +690,10 @@ static void sixpack_close(struct tty_struct *tty)
{
struct sixpack *sp;
write_lock(&disc_data_lock);
write_lock_bh(&disc_data_lock);
sp = tty->disc_data;
tty->disc_data = NULL;
write_unlock(&disc_data_lock);
write_unlock_bh(&disc_data_lock);
if (!sp)
return;
......
......@@ -811,10 +811,10 @@ static void mkiss_close(struct tty_struct *tty)
{
struct mkiss *ax;
write_lock(&disc_data_lock);
write_lock_bh(&disc_data_lock);
ax = tty->disc_data;
tty->disc_data = NULL;
write_unlock(&disc_data_lock);
write_unlock_bh(&disc_data_lock);
if (!ax)
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment