aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2008-02-12 00:24:56 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-12 20:53:31 -0500
commit1105b5d1d44e6f00e31422dfcb0139bc8ae966a9 (patch)
tree14cf0671196b0dbe3de6c51fede38b6d70164850 /net/ax25
parent8315f5d80a90247bf92232f92ca49933ac49327b (diff)
[AX25] af_ax25: remove sock lock in ax25_info_show()
This lockdep warning: > ======================================================= > [ INFO: possible circular locking dependency detected ] > 2.6.24 #3 > ------------------------------------------------------- > swapper/0 is trying to acquire lock: > (ax25_list_lock){-+..}, at: [<f91dd3b1>] ax25_destroy_socket+0x171/0x1f0 [ax25] > > but task is already holding lock: > (slock-AF_AX25){-+..}, at: [<f91dbabc>] ax25_std_heartbeat_expiry+0x1c/0xe0 [ax25] > > which lock already depends on the new lock. ... shows that ax25_list_lock and slock-AF_AX25 are taken in different order: ax25_info_show() takes slock (bh_lock_sock(ax25->sk)) while ax25_list_lock is held, so reversely to other functions. To fix this the sock lock should be moved to ax25_info_start(), and there would be still problem with breaking ax25_list_lock (it seems this "proper" order isn't optimal yet). But, since it's only for reading proc info it seems this is not necessary (e.g. ax25_send_to_raw() does similar reading without this lock too). So, this patch removes sock lock to avoid deadlock possibility; there is also used sock_i_ino() function, which reads sk_socket under proper read lock. Additionally printf format of this i_ino is changed to %lu. Reported-by: Bernard Pidoux F6BVP <f6bvp@free.fr> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/af_ax25.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8fc64e3150a2..5a4337a29094 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1928,12 +1928,10 @@ static int ax25_info_show(struct seq_file *seq, void *v)
1928 ax25->paclen); 1928 ax25->paclen);
1929 1929
1930 if (ax25->sk != NULL) { 1930 if (ax25->sk != NULL) {
1931 bh_lock_sock(ax25->sk); 1931 seq_printf(seq, " %d %d %lu\n",
1932 seq_printf(seq," %d %d %ld\n",
1933 atomic_read(&ax25->sk->sk_wmem_alloc), 1932 atomic_read(&ax25->sk->sk_wmem_alloc),
1934 atomic_read(&ax25->sk->sk_rmem_alloc), 1933 atomic_read(&ax25->sk->sk_rmem_alloc),
1935 ax25->sk->sk_socket != NULL ? SOCK_INODE(ax25->sk->sk_socket)->i_ino : 0L); 1934 sock_i_ino(ax25->sk));
1936 bh_unlock_sock(ax25->sk);
1937 } else { 1935 } else {
1938 seq_puts(seq, " * * *\n"); 1936 seq_puts(seq, " * * *\n");
1939 } 1937 }