From patchwork Wed Jun 15 18:51:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasiliy Kulikov X-Patchwork-Id: 100562 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 87F4AB6F95 for ; Thu, 16 Jun 2011 04:53:06 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753812Ab1FOSv5 (ORCPT ); Wed, 15 Jun 2011 14:51:57 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:63060 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753731Ab1FOSvz (ORCPT ); Wed, 15 Jun 2011 14:51:55 -0400 Received: by mail-fx0-f46.google.com with SMTP id 17so618697fxm.19 for ; Wed, 15 Jun 2011 11:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer; bh=gI9EYgF1b9LDroO4v/X6GzD25sxM6DLPxnJ1g56uhsM=; b=NyM7Ty4lqZ9rzjIvdmFHhq++j3Cr+VISA++CYI2DfLfghY9UkY0uL07G0/MZ8KCSo4 8rZkoGN+/xgiXvuYXHSsUoc3v4GLrv4hQ9WElYdIgO2k2STYkO6yaRcA94do08DiEwVg CVA1tVEW4qsG8Xe+Iz6a8HTkkqNzLCpfCGOQ8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; b=SZiehBp1aVu0vCV1+JpkETnIYskH3PiNGBNtS5hELLLju1nLvXz4SR2ftmjIDqTiSN bWMEpVYae+zcPI8jxF4vveyZXQuQtJl1Si7JYhtvwrTqRpp2Uqub2zqLS3t4NCy4C+bW 1YIsjkg9M0b3FMBAuVdM/CTRSj+CEU6zBYpqA= Received: by 10.223.81.80 with SMTP id w16mr87968fak.65.1308163914176; Wed, 15 Jun 2011 11:51:54 -0700 (PDT) Received: from localhost (ppp85-140-24-53.pppoe.mtu-net.ru [85.140.24.53]) by mx.google.com with ESMTPS id n7sm391266fam.19.2011.06.15.11.51.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 15 Jun 2011 11:51:53 -0700 (PDT) From: Vasiliy Kulikov To: linux-kernel@vger.kernel.org Cc: kernel-hardening@lists.openwall.com, Andrew Morton , Greg Kroah-Hartman , "David S. Miller" , Arnd Bergmann , "Eric W. Biederman" , Daniel Lezcano , "Paul E. McKenney" , Stephen Rothwell , netdev@vger.kernel.org Subject: [RFC 3/5 v4] net: restore net_create and make it globally visible Date: Wed, 15 Jun 2011 22:51:50 +0400 Message-Id: <1308163910-6104-1-git-send-email-segoon@openwall.com> X-Mailer: git-send-email 1.7.0.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This reverts commit 911cb193f3eb0370f20fbba712211e55ffede4de and makes net_create() globally visible. net_create() will be needed for fake_net in fs/proc/proc_net.c. Signed-off-by: Vasiliy Kulikov --- include/net/net_namespace.h | 2 ++ net/core/net_namespace.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 2bf9ed9..5d5328c 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -116,6 +116,8 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) } #endif /* CONFIG_NET */ +extern struct net *net_create(void); + extern struct list_head net_namespace_list; diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 6c6b86d..c90f0db 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -210,14 +210,11 @@ static void net_free(struct net *net) kmem_cache_free(net_cachep, net); } -struct net *copy_net_ns(unsigned long flags, struct net *old_net) +struct net *net_create(void) { struct net *net; int rv; - if (!(flags & CLONE_NEWNET)) - return get_net(old_net); - net = net_alloc(); if (!net) return ERR_PTR(-ENOMEM); @@ -236,6 +233,13 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net) return net; } +struct net *copy_net_ns(unsigned long flags, struct net *old_net) +{ + if (!(flags & CLONE_NEWNET)) + return get_net(old_net); + return net_create(); +} + static DEFINE_SPINLOCK(cleanup_list_lock); static LIST_HEAD(cleanup_list); /* Must hold cleanup_list_lock to touch */