Skip to content

Commit 6e4e2f8

Browse files
arndbdavem330
authored andcommitted
6pack,mkiss: fix lock inconsistency
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: Bernard F6BVP <[email protected]> Tested-by: Bernard F6BVP <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Ralf Baechle<[email protected]> Cc: [email protected] Signed-off-by: David S. Miller <[email protected]>
1 parent 60c2ce2 commit 6e4e2f8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/net/hamradio/6pack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,10 @@ static void sixpack_close(struct tty_struct *tty)
692692
{
693693
struct sixpack *sp;
694694

695-
write_lock(&disc_data_lock);
695+
write_lock_bh(&disc_data_lock);
696696
sp = tty->disc_data;
697697
tty->disc_data = NULL;
698-
write_unlock(&disc_data_lock);
698+
write_unlock_bh(&disc_data_lock);
699699
if (!sp)
700700
return;
701701

drivers/net/hamradio/mkiss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,10 +813,10 @@ static void mkiss_close(struct tty_struct *tty)
813813
{
814814
struct mkiss *ax;
815815

816-
write_lock(&disc_data_lock);
816+
write_lock_bh(&disc_data_lock);
817817
ax = tty->disc_data;
818818
tty->disc_data = NULL;
819-
write_unlock(&disc_data_lock);
819+
write_unlock_bh(&disc_data_lock);
820820

821821
if (!ax)
822822
return;

0 commit comments

Comments
 (0)