linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Florian Westphal <fw@strlen.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 050/118] netfilter: nft_compat: ebtables nat table is normal chain type
Date: Mon, 26 Nov 2018 11:50:44 +0100	[thread overview]
Message-ID: <20181126105102.824844415@linuxfoundation.org> (raw)
In-Reply-To: <20181126105059.832485122@linuxfoundation.org>

4.19-stable review patch.  If anyone has any objections, please let me know.

------------------

[ Upstream commit e4844c9c62a0fe47980d6c3d4b7a096a5d755925 ]

Unlike ip(6)tables, the ebtables nat table has no special properties.
This bug causes 'ebtables -A' to fail when using a target such as
'snat' (ebt_snat target sets ".table = "nat"').  Targets that have
no table restrictions work fine.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/nft_compat.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 32535eea51b2..ad2fe6a7e47d 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -54,9 +54,11 @@ static bool nft_xt_put(struct nft_xt *xt)
 	return false;
 }
 
-static int nft_compat_chain_validate_dependency(const char *tablename,
-						const struct nft_chain *chain)
+static int nft_compat_chain_validate_dependency(const struct nft_ctx *ctx,
+						const char *tablename)
 {
+	enum nft_chain_types type = NFT_CHAIN_T_DEFAULT;
+	const struct nft_chain *chain = ctx->chain;
 	const struct nft_base_chain *basechain;
 
 	if (!tablename ||
@@ -64,9 +66,12 @@ static int nft_compat_chain_validate_dependency(const char *tablename,
 		return 0;
 
 	basechain = nft_base_chain(chain);
-	if (strcmp(tablename, "nat") == 0 &&
-	    basechain->type->type != NFT_CHAIN_T_NAT)
-		return -EINVAL;
+	if (strcmp(tablename, "nat") == 0) {
+		if (ctx->family != NFPROTO_BRIDGE)
+			type = NFT_CHAIN_T_NAT;
+		if (basechain->type->type != type)
+			return -EINVAL;
+	}
 
 	return 0;
 }
@@ -323,8 +328,7 @@ static int nft_target_validate(const struct nft_ctx *ctx,
 		if (target->hooks && !(hook_mask & target->hooks))
 			return -EINVAL;
 
-		ret = nft_compat_chain_validate_dependency(target->table,
-							   ctx->chain);
+		ret = nft_compat_chain_validate_dependency(ctx, target->table);
 		if (ret < 0)
 			return ret;
 	}
@@ -570,8 +574,7 @@ static int nft_match_validate(const struct nft_ctx *ctx,
 		if (match->hooks && !(hook_mask & match->hooks))
 			return -EINVAL;
 
-		ret = nft_compat_chain_validate_dependency(match->table,
-							   ctx->chain);
+		ret = nft_compat_chain_validate_dependency(ctx, match->table);
 		if (ret < 0)
 			return ret;
 	}
-- 
2.17.1




  parent reply	other threads:[~2018-11-26 11:03 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26 10:49 [PATCH 4.19 000/118] 4.19.5-stable review Greg Kroah-Hartman
2018-11-26 10:49 ` [PATCH 4.19 001/118] drm/i915: Replace some PAGE_SIZE with I915_GTT_PAGE_SIZE Greg Kroah-Hartman
2018-11-26 10:49 ` [PATCH 4.19 002/118] cifs: dont dereference smb_file_target before null check Greg Kroah-Hartman
2018-11-26 10:49 ` [PATCH 4.19 003/118] cifs: fix return value for cifs_listxattr Greg Kroah-Hartman
2018-11-26 10:49 ` [PATCH 4.19 004/118] arm64: kprobe: make page to RO mode when allocate it Greg Kroah-Hartman
2018-11-26 10:49 ` [PATCH 4.19 005/118] nvme-pci: fix conflicting p2p resource adds Greg Kroah-Hartman
2018-11-26 19:23   ` Logan Gunthorpe
2018-11-27 10:01     ` Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 006/118] block: brd: associate with queue until adding disk Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 007/118] net: hns3: bugfix for rtnl_locks range in the hclgevf_reset() Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 008/118] net: hns3: bugfix for rtnl_locks range in the hclge_reset() Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 009/118] net: hns3: bugfix for handling mailbox while the command queue reinitialized Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 010/118] net: hns3: bugfix for the initialization of command queues spin lock Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 011/118] ixgbe: fix MAC anti-spoofing filter after VFLR Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 012/118] reiserfs: propagate errors from fill_with_dentries() properly Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 013/118] hfs: prevent btree data loss on root split Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 014/118] hfsplus: " Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 015/118] perf unwind: Take pgoff into account when reporting elf to libdwfl Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 016/118] um: Give start_idle_thread() a return code Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 017/118] drm/edid: Add 6 bpc quirk for BOE panel Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 018/118] afs: Handle EIO from delivery function Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 019/118] platform/x86: intel_telemetry: report debugfs failure Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 020/118] clk: fixed-rate: fix of_node_get-put imbalance Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 021/118] perf symbols: Set PLT entry/header sizes properly on Sparc Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 022/118] fs/exofs: fix potential memory leak in mount option parsing Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 023/118] clk: samsung: exynos5420: Enable PERIS clocks for suspend Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 024/118] apparmor: Fix uninitialized value in aa_split_fqname Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 025/118] x86/earlyprintk: Add a force option for pciserial device Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 026/118] platform/x86: acerhdf: Add BIOS entry for Gateway LT31 v1.3307 Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 027/118] clk: meson-axg: pcie: drop the mpll3 clock parent Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 028/118] arm64: percpu: Initialize ret in the default case Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 029/118] clk: meson: clk-pll: drop CLK_GET_RATE_NOCACHE where unnecessary Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 030/118] clk: renesas: r9a06g032: Fix UART34567 clock rate Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 031/118] clk: ti: fix OF child-node lookup Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 032/118] serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 033/118] netfilter: ipv6: fix oops when defragmenting locally generated fragments Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 034/118] netfilter: bridge: define INT_MIN & INT_MAX in userspace Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 035/118] s390/decompressor: add missing FORCE to build targets Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 036/118] s390/vdso: " Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 037/118] HID: i2c-hid: Add a small delay after sleep command for Raydium touchpanel Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 038/118] Revert "HID: add NOGET quirk for Eaton Ellipse MAX UPS" Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 039/118] HID: alps: allow incoming reports when only the trackstick is opened Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 040/118] Revert "netfilter: nft_numgen: add map lookups for numgen random operations" Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 041/118] netfilter: ipset: list:set: Decrease refcount synchronously on deletion and replace Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 042/118] netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 043/118] netfilter: ipset: fix ip_set_list allocation failure Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 044/118] s390/mm: fix mis-accounting of pgtable_bytes Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 045/118] s390/mm: Fix ERROR: "__node_distance" undefined! Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 046/118] bpf: fix bpf_prog_get_info_by_fd to return 0 func_lens for unpriv Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 047/118] netfilter: ipset: Correct rcu_dereference() call in ip_set_put_comment() Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 048/118] netfilter: xt_IDLETIMER: add sysfs filename checking routine Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 049/118] netfilter: ipset: Fix calling ip_set() macro at dumping Greg Kroah-Hartman
2018-11-26 10:50 ` Greg Kroah-Hartman [this message]
2018-11-26 10:50 ` [PATCH 4.19 051/118] s390/qeth: fix HiperSockets sniffer Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 052/118] s390/qeth: unregister netdevice only when registered Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 053/118] net: hns3: Fix for out-of-bounds access when setting pfc back pressure Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 054/118] hwmon: (ibmpowernv) Remove bogus __init annotations Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 055/118] ARM: dts: imx6sll: fix typo for fsl,imx6sll-i2c node Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 056/118] ARM: dts: fsl: Fix improperly quoted stdout-path values Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 057/118] Revert "drm/exynos/decon5433: implement frame counter" Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 058/118] arm64: dts: renesas: r8a7795: add missing dma-names on hscif2 Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 059/118] arm64: dts: renesas: condor: switch from EtherAVB to GEther Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 060/118] xen/grant-table: Fix incorrect gnttab_dma_free_pages() pr_debug message Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 061/118] clk: fixed-factor: fix of_node_get-put imbalance Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 062/118] mtd: nand: Fix nanddev_pos_next_page() kernel-doc header Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 063/118] lib/raid6: Fix arm64 test build Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 064/118] drm/amd/display: Stop leaking planes Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.19 065/118] block: Clear kernel memory before copying to user Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 066/118] drm/amd/display: Drop reusing drm connector for MST Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 067/118] drm/amd/amdgpu/dm: Fix dm_dp_create_fake_mst_encoder() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 068/118] s390/perf: Change CPUM_CF return code in event init function Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 069/118] ceph: quota: fix null pointer dereference in quota check Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 070/118] of/device: Really only set bus DMA mask when appropriate Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 071/118] nvme: make sure ns head inherits underlying device limits Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 072/118] i2c: omap: Enable for ARCH_K3 Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 073/118] i2c: qcom-geni: Fix runtime PM mismatch with child devices Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 074/118] sched/core: Take the hotplug lock in sched_init_smp() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 075/118] perf tools: Fix undefined symbol scnprintf in libperf-jvmti.so Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 076/118] perf tools: Do not zero sample_id_all for group members Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 077/118] ice: Fix dead device link issue with flow control Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 078/118] ice: Fix the bytecount sent to netdev_tx_sent_queue Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 079/118] ice: Change req_speeds to be u16 Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 080/118] i40e: restore NETIF_F_GSO_IPXIP[46] to netdev features Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 081/118] qed: Fix memory/entry leak in qed_init_sp_request() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 082/118] qed: Fix blocking/unlimited SPQ entries leak Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 083/118] qed: Fix SPQ entries not returned to pool in error flows Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 084/118] qed: Fix potential memory corruption Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 085/118] net: stmmac: Fix RX packet size > 8191 Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 086/118] net: aquantia: fix potential IOMMU fault after driver unbind Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 087/118] net: aquantia: fixed enable unicast on 32 macvlan Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 088/118] net: aquantia: invalid checksumm offload implementation Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 089/118] kbuild: deb-pkg: fix too low build version number Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 090/118] Revert "scripts/setlocalversion: git: Make -dirty check more robust" Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 091/118] SUNRPC: drop pointless static qualifier in xdr_get_next_encode_buffer() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 092/118] x86/mm: Move LDT remap out of KASLR region on 5-level paging Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 093/118] x86/ldt: Unmap PTEs for the slot before freeing LDT pages Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 094/118] x86/ldt: Remove unused variable in map_ldt_struct() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 095/118] media: v4l: event: Add subscription to list before calling "add" operation Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 096/118] MIPS: OCTEON: cavium_octeon_defconfig: re-enable OCTEON USB driver Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 097/118] RISC-V: Fix raw_copy_{to,from}_user() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 098/118] uio: Fix an Oops on load Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 099/118] ALSA: hda/realtek - Add quirk entry for HP Pavilion 15 Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 100/118] ALSA: hda/ca0132 - Call pci_iounmap() instead of iounmap() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 101/118] can: kvaser_usb: Fix accessing freed memory in kvaser_usb_start_xmit() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 102/118] can: kvaser_usb: Fix potential uninitialized variable use Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 103/118] usb: cdc-acm: add entry for Hiro (Conexant) modem Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 104/118] USB: quirks: Add no-lpm quirk for Raydium touchscreens Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 105/118] USB: Wait for extra delay time after USB_PORT_FEAT_RESET for quirky hub Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 106/118] usb: quirks: Add delay-init quirk for Corsair K70 LUX RGB Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 107/118] misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 108/118] USB: misc: appledisplay: add 20" Apple Cinema Display Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 109/118] gnss: serial: fix synchronous write timeout Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 110/118] gnss: sirf: " Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 111/118] mtd: rawnand: atmel: fix OF child-node lookup Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 112/118] drivers/misc/sgi-gru: fix Spectre v1 vulnerability Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 113/118] ACPI / platform: Add SMB0001 HID to forbidden_id_list Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 114/118] HID: uhid: forbid UHID_CREATE under KERNEL_DS or elevated privileges Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 115/118] HID: Add quirk for Primax PIXART OEM mice Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 116/118] HID: Add quirk for Microsoft PIXART OEM mouse Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 117/118] libceph: fall back to sendmsg for slab pages Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.19 118/118] mt76x0: run vco calibration for each channel configuration Greg Kroah-Hartman
2018-11-26 16:29 ` [PATCH 4.19 000/118] 4.19.5-stable review kernelci.org bot
2018-11-26 19:05 ` Guenter Roeck
2018-11-27  9:59   ` Greg Kroah-Hartman
2018-11-27  0:09 ` shuah
2018-11-27  9:58   ` Greg Kroah-Hartman
2018-11-27 10:56 ` Harsh Shandilya
2018-11-27 12:56 ` Naresh Kamboju
2018-11-27 14:38   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181126105102.824844415@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=fw@strlen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).