[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20180807.131809.2208230028881809144.davem@davemloft.net>
Date: Tue, 07 Aug 2018 13:18:09 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: ying.xue@...driver.com
Cc: netdev@...r.kernel.org, jon.maloy@...csson.com,
tipc-discussion@...ts.sourceforge.net
Subject: Re: [PATCH] tipc: fix an interrupt unsafe locking scenario
From: Ying Xue <ying.xue@...driver.com>
Date: Tue, 7 Aug 2018 15:52:32 +0800
> Commit 9faa89d4ed9d ("tipc: make function tipc_net_finalize() thread
> safe") tries to make it thread safe to set node address, so it uses
> node_list_lock lock to serialize the whole process of setting node
> address in tipc_net_finalize(). But it causes the following interrupt
> unsafe locking scenario:
...
> When rhashtable_rehash_table() holds ht->lock on CPU0, it doesn't
> disable BH. So if an interrupt happens after the lock, it can create
> an inverse lock ordering between ht->lock and tn->node_list_lock. As
> a consequence, deadlock might happen.
>
> The reason causing the inverse lock ordering scenario above is because
> the initial purpose of node_list_lock is not designed to do the
> serialization of node address setting.
>
> As cmpxchg() can guarantee CAS (compare-and-swap) process is atomic,
> we use it to replace node_list_lock to ensure setting node address can
> be atomically finished. It turns out the potential deadlock can be
> avoided as well.
>
> Fixes: 9faa89d4ed9d ("tipc: make function tipc_net_finalize() thread safe")
> Signed-off-by: Ying Xue <ying.xue@...driver.com>
Applied, thanks.
Powered by blists - more mailing lists