Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5452691imm; Tue, 16 Oct 2018 10:26:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV60pYnaVMBRK9GBgM75CPAFKjq0ztjvy0e3DsxsPaTp5hAF11D9YBTLQZ2vN4+Lcbk3TI7Rq X-Received: by 2002:a63:d64b:: with SMTP id d11-v6mr20807488pgj.450.1539710774338; Tue, 16 Oct 2018 10:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710774; cv=none; d=google.com; s=arc-20160816; b=h91BjqmVDgg+2DNzg69X3XsPmTxaVBjAsTVHvCQ5HnoUKitTHm+rZNo62V8LUb5WEt EIM7vKp1imstaQktxWNcMXyCH9CQQjo/K581IY0/86r/3WU40IwwAv3x8nx/aI2LEkZX 0SI+ReL5B7eNHXvvKDxyxTic8UFxgwoNoA0o4/h4IIQJ+xE7gXaWU/LCJPCDS1H6Or2m yrwgItxaDAzBLXwTta3FilYME0aBJjbHhXaqcAVz1nf6ateD0wFcwKoxpKMDmOkL+Vk/ 6WrQdRw0/t54+hsqL10ojNTElSOlpbZ17yy0Qz4iQynpdtiN3a0tR9lW9MgINHpiIVMC KqUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FM7iqMXn04eCBvZCcPT31GRDb5cAI0asmJXljKgIFBk=; b=ZeiDbErj1YiVLAzfu7mb2y1BXKWp4zECh2SzuVOhPkNp0VMI+hGyRB+vhUqpqZU/2E 5tH5g9qCNiam73LOaUYAaPUULR2hp2WYSRyMbtpHHa2ryiq7jL4DEjbOxLZBGIpx7jwi qJ1/3WBmAxJWdKpbanb396peQSVWcFWjj67B3K6q1iB6qOxxnJS5CaYFXPYKACE0ohcP WoKr8QdvOtPUChm0p4ilQEj4wq6SXbYk2nQUlfhNKtoSqOghJhTlXgWCJdBgy4OZYQNU 5Ba9sp/ZVYRaiXYgwRysJLUB1QBt1J98q7UA5nTUGBe4q5OFP/b07Tc7migX//4X8yHr tucQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kt8AsNtS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k6-v6si14280752pls.174.2018.10.16.10.25.58; Tue, 16 Oct 2018 10:26:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kt8AsNtS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731644AbeJQBPq (ORCPT + 99 others); Tue, 16 Oct 2018 21:15:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:34408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBPq (ORCPT ); Tue, 16 Oct 2018 21:15:46 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA65220866; Tue, 16 Oct 2018 17:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710659; bh=CKmERwvZHQNLKcBXVzi7vCvAyo9JQQBC4IuQgfNcqcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kt8AsNtS4MXGOdZKTkQamuN5XLyjF8wM9Tg44vcomj1rINFI+ItXKtiHxd0G5rlg7 AgpLFRJO3FPfNCC+hGoA9ckP8jhzyQ35r/GqKt4r19KJtrRxGR9l/44/qLHPpfAYFG 6f5LfP3pWvdXYbhStqClcQnBmmRA0io3GQcIbex4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 4.9 43/71] inet: frags: change inet_frags_init_net() return value Date: Tue, 16 Oct 2018 19:09:40 +0200 Message-Id: <20181016170541.532847208@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet We will soon initialize one rhashtable per struct netns_frags in inet_frags_init_net(). This patch changes the return value to eventually propagate an error. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller (cherry picked from commit 787bea7748a76130566f881c2342a0be4127d182) Signed-off-by: Greg Kroah-Hartman --- include/net/inet_frag.h | 3 ++- net/ieee802154/6lowpan/reassembly.c | 11 ++++++++--- net/ipv4/ip_fragment.c | 12 +++++++++--- net/ipv6/netfilter/nf_conntrack_reasm.c | 12 +++++++++--- net/ipv6/reassembly.c | 11 +++++++++-- 5 files changed, 37 insertions(+), 12 deletions(-) --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -103,9 +103,10 @@ struct inet_frags { int inet_frags_init(struct inet_frags *); void inet_frags_fini(struct inet_frags *); -static inline void inet_frags_init_net(struct netns_frags *nf) +static inline int inet_frags_init_net(struct netns_frags *nf) { atomic_set(&nf->mem, 0); + return 0; } void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f); --- a/net/ieee802154/6lowpan/reassembly.c +++ b/net/ieee802154/6lowpan/reassembly.c @@ -580,14 +580,19 @@ static int __net_init lowpan_frags_init_ { struct netns_ieee802154_lowpan *ieee802154_lowpan = net_ieee802154_lowpan(net); + int res; ieee802154_lowpan->frags.high_thresh = IPV6_FRAG_HIGH_THRESH; ieee802154_lowpan->frags.low_thresh = IPV6_FRAG_LOW_THRESH; ieee802154_lowpan->frags.timeout = IPV6_FRAG_TIMEOUT; - inet_frags_init_net(&ieee802154_lowpan->frags); - - return lowpan_frags_ns_sysctl_register(net); + res = inet_frags_init_net(&ieee802154_lowpan->frags); + if (res < 0) + return res; + res = lowpan_frags_ns_sysctl_register(net); + if (res < 0) + inet_frags_exit_net(&ieee802154_lowpan->frags, &lowpan_frags); + return res; } static void __net_exit lowpan_frags_exit_net(struct net *net) --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -849,6 +849,8 @@ static void __init ip4_frags_ctl_registe static int __net_init ipv4_frags_init_net(struct net *net) { + int res; + /* Fragment cache limits. * * The fragment memory accounting code, (tries to) account for @@ -874,9 +876,13 @@ static int __net_init ipv4_frags_init_ne net->ipv4.frags.max_dist = 64; - inet_frags_init_net(&net->ipv4.frags); - - return ip4_frags_ns_ctl_register(net); + res = inet_frags_init_net(&net->ipv4.frags); + if (res < 0) + return res; + res = ip4_frags_ns_ctl_register(net); + if (res < 0) + inet_frags_exit_net(&net->ipv4.frags, &ip4_frags); + return res; } static void __net_exit ipv4_frags_exit_net(struct net *net) --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c @@ -630,12 +630,18 @@ EXPORT_SYMBOL_GPL(nf_ct_frag6_gather); static int nf_ct_net_init(struct net *net) { + int res; + net->nf_frag.frags.high_thresh = IPV6_FRAG_HIGH_THRESH; net->nf_frag.frags.low_thresh = IPV6_FRAG_LOW_THRESH; net->nf_frag.frags.timeout = IPV6_FRAG_TIMEOUT; - inet_frags_init_net(&net->nf_frag.frags); - - return nf_ct_frag6_sysctl_register(net); + res = inet_frags_init_net(&net->nf_frag.frags); + if (res < 0) + return res; + res = nf_ct_frag6_sysctl_register(net); + if (res < 0) + inet_frags_exit_net(&net->nf_frag.frags, &nf_frags); + return res; } static void nf_ct_net_exit(struct net *net) --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c @@ -709,13 +709,20 @@ static void ip6_frags_sysctl_unregister( static int __net_init ipv6_frags_init_net(struct net *net) { + int res; + net->ipv6.frags.high_thresh = IPV6_FRAG_HIGH_THRESH; net->ipv6.frags.low_thresh = IPV6_FRAG_LOW_THRESH; net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT; - inet_frags_init_net(&net->ipv6.frags); + res = inet_frags_init_net(&net->ipv6.frags); + if (res < 0) + return res; - return ip6_frags_ns_sysctl_register(net); + res = ip6_frags_ns_sysctl_register(net); + if (res < 0) + inet_frags_exit_net(&net->ipv6.frags, &ip6_frags); + return res; } static void __net_exit ipv6_frags_exit_net(struct net *net)