Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752727AbbG3XAe (ORCPT ); Thu, 30 Jul 2015 19:00:34 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:41842 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbbG3XAH (ORCPT ); Thu, 30 Jul 2015 19:00:07 -0400 Date: Thu, 30 Jul 2015 16:00:06 -0700 (PDT) Message-Id: <20150730.160006.1603147920495272496.davem@davemloft.net> To: sowmini.varadhan@oracle.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, edumazet@google.com, willemb@google.com, ebiederm@xmission.com, alexander.h.duyck@intel.com, ast@plumgrid.com, hannes@stressinduktion.org, dborkman@redhat.com Subject: Re: [PATCH v2 net] net: sk_clone_lock() should only do get_net() if the parent is not a kernel socket From: David Miller In-Reply-To: <20150730135036.GA17366@oracle.com> References: <20150730135036.GA17366@oracle.com> X-Mailer: Mew version 6.6 on Emacs 24.5 / 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, 30 Jul 2015 16:00:07 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1308 Lines: 31 From: Sowmini Varadhan Date: Thu, 30 Jul 2015 15:50:36 +0200 > > > The newsk returned by sk_clone_lock should hold a get_net() > reference if, and only if, the parent is not a kernel socket > (making this similar to sk_alloc()). > > E.g,. for the SYN_RECV path, tcp_v4_syn_recv_sock->..inet_csk_clone_lock > sets up the syn_recv newsk from sk_clone_lock. When the parent (listen) > socket is a kernel socket (defined in sk_alloc() as having > sk_net_refcnt == 0), then the newsk should also have a 0 sk_net_refcnt > and should not hold a get_net() reference. > > Fixes: 26abe14379f8 ("net: Modify sk_alloc to not reference count the > netns of kernel sockets.") > Acked-by: Eric Dumazet > Cc: Eric W. Biederman > Signed-off-by: Sowmini Varadhan > --- > v2: pulled patch #3 out of the RFC patch-set for RDS-TCP netns fixes; > Added Fixes, Acked-by, Cc fields based on mailing list feedback > from Eric Dumazet. Applied, thanks everyone. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/