Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753952AbdHXVDB (ORCPT ); Thu, 24 Aug 2017 17:03:01 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:53056 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753907AbdHXVC7 (ORCPT ); Thu, 24 Aug 2017 17:02:59 -0400 Date: Thu, 24 Aug 2017 14:02:58 -0700 (PDT) Message-Id: <20170824.140258.238955887232472310.davem@davemloft.net> To: rpeterso@redhat.com Cc: herbert@gondor.apana.org.au, psutter@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tipc: Fix tipc_sk_reinit handling of -EAGAIN From: David Miller In-Reply-To: <25145358.1155254.1503499382947.JavaMail.zimbra@redhat.com> References: <1907606232.1152250.1503498773672.JavaMail.zimbra@redhat.com> <25145358.1155254.1503499382947.JavaMail.zimbra@redhat.com> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 24 Aug 2017 14:02:58 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1060 Lines: 24 From: Bob Peterson Date: Wed, 23 Aug 2017 10:43:02 -0400 (EDT) > In 9dbbfb0ab6680c6a85609041011484e6658e7d3c function tipc_sk_reinit > had additional logic added to loop in the event that function > rhashtable_walk_next() returned -EAGAIN. No worries. > > However, if rhashtable_walk_start returns -EAGAIN, it does "continue", > and therefore skips the call to rhashtable_walk_stop(). That has > the effect of calling rcu_read_lock() without its paired call to > rcu_read_unlock(). Since rcu_read_lock() may be nested, the problem > may not be apparent for a while, especially since resize events may > be rare. But the comments to rhashtable_walk_start() state: > > * ...Note that we take the RCU lock in all > * cases including when we return an error. So you must always call > * rhashtable_walk_stop to clean up. > > This patch replaces the continue with a goto and label to ensure a > matching call to rhashtable_walk_stop(). > > Signed-off-by: Bob Peterson Applied and queued up for -stable, thanks.