From: David Miller <davem@davemloft.net>
To: jarkao2@gmail.com
Cc: f6bvp@free.fr, ralf@linux-mips.org, jann@gmx.de, netdev@vger.kernel.org
Subject: Re: [PATCH v2][AX25] af_ax25: remove sock lock in ax25_info_show()
Date: Mon, 11 Feb 2008 21:25:50 -0800 (PST) [thread overview]
Message-ID: <20080211.212550.45678043.davem@davemloft.net> (raw)
In-Reply-To: <20080210131051.GA7750@ami.dom.local>
From: Jarek Poplawski <jarkao2@gmail.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@free.fr>
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.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 :-)
prev parent reply other threads:[~2008-02-12 5:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-17 10:06 [ROSE] [AX25] possible circular locking Bernard Pidoux F6BVP
2007-12-18 13:52 ` Jarek Poplawski
[not found] ` <476837BF.3070207@free.fr>
2007-12-18 22:04 ` Jarek Poplawski
2007-12-28 21:30 ` Pidoux
[not found] ` <47755FDB.2070501@free.fr>
2007-12-28 21:48 ` [PATCH][ROSE][AX25] af_ax25: " Jarek Poplawski
2007-12-30 3:14 ` David Miller
2007-12-30 14:13 ` Jarek Poplawski
2007-12-31 5:00 ` David Miller
2008-01-11 5:22 ` David Miller
2008-01-11 9:40 ` Jarek Poplawski
2008-01-12 19:48 ` Bernard Pidoux F6BVP
2008-01-11 21:40 ` [PATCH] [ROSE] two extra tab characters removed Bernard Pidoux F6BVP
2008-02-09 18:44 ` [PATCH][AX25] ax25_ds_timer: use mod_timer instead of add_timer Bernard Pidoux F6BVP
2008-02-09 19:39 ` Jarek Poplawski
2008-02-10 18:07 ` Bernard Pidoux F6BVP
2008-02-09 23:50 ` [PATCH][AX25] af_ax25: remove sock lock in ax25_info_show() Jarek Poplawski
2008-02-10 13:10 ` [PATCH v2][AX25] " Jarek Poplawski
2008-02-12 5:25 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080211.212550.45678043.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=f6bvp@free.fr \
--cc=jann@gmx.de \
--cc=jarkao2@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).