[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20080211.212550.45678043.davem@davemloft.net>
Date: Mon, 11 Feb 2008 21:25:50 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: jarkao2@...il.com
Cc: f6bvp@...e.fr, ralf@...ux-mips.org, jann@....de,
netdev@...r.kernel.org
Subject: Re: [PATCH v2][AX25] af_ax25: remove sock lock in ax25_info_show()
From: Jarek Poplawski <jarkao2@...il.com>
Date: Sun, 10 Feb 2008 14:10:51 +0100
> [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@...e.fr>
> Signed-off-by: Jarek Poplawski <jarkao2@...il.com>
Applied, thanks Jarek.
> + sock_i_ino(ax25->sk));
Note that this taks the sk callback lock, it should be OK but
let's keep a watch out for any new lockdep warnings this
ends up causing :-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists