netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ying.xue@windriver.com
Cc: netdev@vger.kernel.org, jon.maloy@ericsson.com,
	Paul.Gortmaker@windriver.com, erik.hugne@ericsson.com,
	lars.everbrand@ericsson.com,
	tipc-discussion@lists.sourceforge.net
Subject: Re: [PATCH] tipc: fix deadlock during socket release
Date: Sun, 29 Dec 2013 22:24:35 -0500 (EST)	[thread overview]
Message-ID: <20131229.222435.1179109367469102281.davem@davemloft.net> (raw)
In-Reply-To: <1388110708-11890-1-git-send-email-ying.xue@windriver.com>

From: Ying Xue <ying.xue@windriver.com>
Date: Fri, 27 Dec 2013 10:18:28 +0800

> A deadlock might occur if name table is withdrawn in socket release
> routine, and while packets are still being received from bearer.
> 
>        CPU0                       CPU1
> T0:   recv_msg()               release()
> T1:   tipc_recv_msg()          tipc_withdraw()
> T2:   [grab node lock]         [grab port lock]
> T3:   tipc_link_wakeup_ports() tipc_nametbl_withdraw()
> T4:   [grab port lock]*        named_cluster_distribute()
> T5:   wakeupdispatch()         tipc_link_send()
> T6:                            [grab node lock]*
> 
> The opposite order of holding port lock and node lock on above two
> different paths may result in a deadlock. If socket lock instead of
> port lock is used to protect port instance in tipc_withdraw(), the
> reverse order of holding port lock and node lock will be eliminated,
> as a result, the deadlock is killed as well.
> 
> Reported-by: Lars Everbrand <lars.everbrand@ericsson.com>
> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
> Signed-off-by: Ying Xue <ying.xue@windriver.com>

Applied, thanks.

      reply	other threads:[~2013-12-30  3:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-27  2:18 [PATCH] tipc: fix deadlock during socket release Ying Xue
2013-12-30  3:24 ` 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=20131229.222435.1179109367469102281.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Paul.Gortmaker@windriver.com \
    --cc=erik.hugne@ericsson.com \
    --cc=jon.maloy@ericsson.com \
    --cc=lars.everbrand@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=ying.xue@windriver.com \
    /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).