From: Jarek Poplawski <jarkao2@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Pidoux <f6bvp@free.fr>, Ralf Baechle DL5RB <ralf@linux-mips.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH][ROSE][AX25] af_ax25: possible circular locking
Date: Fri, 28 Dec 2007 22:48:57 +0100 [thread overview]
Message-ID: <20071228214857.GA3290@ami.dom.local> (raw)
In-Reply-To: <47755FDB.2070501@free.fr>
On Fri, Dec 28, 2007 at 09:43:07PM +0100, Pidoux wrote:
...
> After a few days of observation and a number of reboot for test purpose, I
> confirm that your patch is doing very well.
> I have no more problems rebooting and the AX25 applications are running
> fine.
>
> I hope this patch, with or without warning, could be applied in next kernel
> release.
>
> Thanks again Jarek.
>
> Regards from Bernard P.
> f6bvp
Thanks again Bernard.
Jarek P. too
---------------->
Subject: [ROSE][AX25] af_ax25: possible circular locking
Bernard Pidoux F6BVP reported:
> When I killall kissattach I can see the following message.
>
> This happens on kernel 2.6.24-rc5 already patched with the 6 previously
> patches I sent recently.
>
>
> =======================================================
> [ INFO: possible circular locking dependency detected ]
> 2.6.23.9 #1
> -------------------------------------------------------
> kissattach/2906 is trying to acquire lock:
> (linkfail_lock){-+..}, at: [<d8bd4603>] ax25_link_failed+0x11/0x39 [ax25]
>
> but task is already holding lock:
> (ax25_list_lock){-+..}, at: [<d8bd7c7c>] ax25_device_event+0x38/0x84
> [ax25]
>
> which lock already depends on the new lock.
>
>
> the existing dependency chain (in reverse order) is:
...
lockdep is worried about the different order here:
#1 (rose_neigh_list_lock){-+..}:
#3 (ax25_list_lock){-+..}:
#0 (linkfail_lock){-+..}:
#1 (rose_neigh_list_lock){-+..}:
#3 (ax25_list_lock){-+..}:
#0 (linkfail_lock){-+..}:
So, ax25_list_lock could be taken before and after linkfail_lock.
I don't know if this three-thread clutch is very probable (or
possible at all), but it seems another bug reported by Bernard
("[...] system impossible to reboot with linux-2.6.24-rc5")
could have similar source - namely ax25_list_lock held by
ax25_kill_by_device() during ax25_disconnect(). It looks like the
only place which calls ax25_disconnect() this way, so I guess, it
isn't necessary.
This patch is breaking the lock for ax25_disconnect(), with some
failsafe and debugging added to detect unforeseen problems.
Reported-and-tested-by: Bernard Pidoux <f6bvp@free.fr>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
diff -Nurp linux-2.6.24-rc5-/net/ax25/af_ax25.c linux-2.6.24-rc5+/net/ax25/af_ax25.c
--- linux-2.6.24-rc5-/net/ax25/af_ax25.c 2007-12-17 13:29:19.000000000 +0100
+++ linux-2.6.24-rc5+/net/ax25/af_ax25.c 2007-12-18 13:36:05.000000000 +0100
@@ -87,10 +87,19 @@ static void ax25_kill_by_device(struct n
return;
spin_lock_bh(&ax25_list_lock);
+again:
ax25_for_each(s, node, &ax25_list) {
if (s->ax25_dev == ax25_dev) {
+ struct hlist_node *nn = node->next;
+
s->ax25_dev = NULL;
+ spin_unlock_bh(&ax25_list_lock);
ax25_disconnect(s, ENETUNREACH);
+ spin_lock_bh(&ax25_list_lock);
+ if (nn != node->next) {
+ WARN_ON_ONCE(1);
+ goto again;
+ }
}
}
spin_unlock_bh(&ax25_list_lock);
next prev parent reply other threads:[~2007-12-28 21:45 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 ` Jarek Poplawski [this message]
2007-12-30 3:14 ` [PATCH][ROSE][AX25] af_ax25: " 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
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=20071228214857.GA3290@ami.dom.local \
--to=jarkao2@gmail.com \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=f6bvp@free.fr \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.