From patchwork Mon Sep 26 16:24:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 675256 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 3sjTp52V3Xz9s4x for ; Tue, 27 Sep 2016 02:25:01 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bytheb-org.20150623.gappssmtp.com header.i=@bytheb-org.20150623.gappssmtp.com header.b=TTvnqW3m; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423183AbcIZQYt (ORCPT ); Mon, 26 Sep 2016 12:24:49 -0400 Received: from mail-yw0-f194.google.com ([209.85.161.194]:33690 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422838AbcIZQYo (ORCPT ); Mon, 26 Sep 2016 12:24:44 -0400 Received: by mail-yw0-f194.google.com with SMTP id g192so9196548ywh.0 for ; Mon, 26 Sep 2016 09:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytheb-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=50JrvfVN0GgrsL5UAxvZA1hceN+dgEQOmNvsN16WAYY=; b=TTvnqW3mGslu3nGvHpM2hGlNb4cqcMWl/H7va2eDFrZ6ECfD3MNoelmbthjJvzJab2 Simoni80R9eHRIjMwj/gAhse1PAmuTb9TIqFqahTvCFK6Ld1wPGwnAUjbbhtqr/0+KQY H3ckHrTkzftB9muqIY7WjRUiR1upsmsJO9fevxs8JTcJhSN9fsoFvlOQ7X1QBxuThMGC LQfVGTO8i3Gx9X0uzyKScqWfBQ35N+OJ9+TwVsjc5J0HnyTzE7cBJ0g7vkZM8bLGqunM QpgnRf1Hs/n5p4AYNMcvEwD9+Pm6CLCMYjpn2X+I5S1MyFSvijBsBal1NAfenTKrwpd1 13xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=50JrvfVN0GgrsL5UAxvZA1hceN+dgEQOmNvsN16WAYY=; b=T9v0UYI2OsZIFy8czBEmwjOJKahGr8it8d6D+FEntJrShXPdwV4CCkuOuq2Q27DzSF GCN6dAH+QIa72i80G3417ySJQORuvDV4nDeDuH8FnFAd7QElvdFsOcWXHwV8L9yOJcrb MdMKW3lFgh0A9gglqg98X1NTJbxGKAVM8h9+Ke9i3ylz35Q1YV8p3iusxYrgWrvyKqmE A4ETe0a9Foz2OO6k8SxD5RX/eyx90YDTaMdLlLQGo0CQ7ei20Yhd5ILvslEF9IM/5ACa 4jPjqgUsqvkjQOS9XcGpAl3hE2vRgYGWLgIKnD5v1UaRf4ddpu6R2NLf81YjP+MUarfZ sudQ== X-Gm-Message-State: AE9vXwORIBjGOea4detgeas/Ext36AXTyZcFEtVXaAoyjQW6GjCV05WGgUC1XjBnS3bVxw== X-Received: by 10.129.23.77 with SMTP id 74mr17609478ywx.335.1474907083586; Mon, 26 Sep 2016 09:24:43 -0700 (PDT) Received: from dhcp-25-97.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id 187sm9084072ywb.21.2016.09.26.09.24.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Sep 2016 09:24:42 -0700 (PDT) From: Aaron Conole To: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org Cc: Florian Westphal , Pablo Neira Ayuso Subject: [PATCH nf-next 2/2] nf_set_hooks_head: acommodate different kconfig Date: Mon, 26 Sep 2016 12:24:31 -0400 Message-Id: <1474907071-13591-3-git-send-email-aconole@bytheb.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474907071-13591-1-git-send-email-aconole@bytheb.org> References: <1474907071-13591-1-git-send-email-aconole@bytheb.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When CONFIG_NETFILTER_INGRESS is unset (or no), we need to handle the request for registration properly by dropping the hook. This releases the entry during the set. Signed-off-by: Aaron Conole --- net/netfilter/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/netfilter/core.c b/net/netfilter/core.c index e58e420..1d0a4c9 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -90,10 +90,14 @@ static void nf_set_hooks_head(struct net *net, const struct nf_hook_ops *reg, { switch (reg->pf) { case NFPROTO_NETDEV: +#ifdef CONFIG_NETFILTER_INGRESS /* We already checked in nf_register_net_hook() that this is * used from ingress. */ rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry); +#else + kfree(entry); +#endif break; default: rcu_assign_pointer(net->nf.hooks[reg->pf][reg->hooknum],