Return-Path: Received: from mail-co1nam03on0130.outbound.protection.outlook.com ([104.47.40.130]:11340 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032242AbeCAPbG (ORCPT ); Thu, 1 Mar 2018 10:31:06 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Hongxu Jia , Pablo Neira Ayuso , Sasha Levin Subject: [added to the 4.1 stable tree] netfilter: arp_tables: fix invoking 32bit "iptable -P INPUT ACCEPT" failed in 64bit kernel Date: Thu, 1 Mar 2018 15:24:44 +0000 Message-ID: <20180301152116.1486-218-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Hongxu Jia This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 17a49cd549d9dc8707dc9262210166455c612dde ] Since 09d9686047db ("netfilter: x_tables: do compat validation via translate_table"), it used compatr structure to assign newinfo structure. In translate_compat_table of ip_tables.c and ip6_tables.c, it used compatr->hook_entry to replace info->hook_entry and compatr->underflow to replace info->underflow, but not do the same replacement in arp_tables.c. It caused invoking 32-bit "arptbale -P INPUT ACCEPT" failed in 64bit kernel. -------------------------------------- root@qemux86-64:~# arptables -P INPUT ACCEPT root@qemux86-64:~# arptables -P INPUT ACCEPT ERROR: Policy for `INPUT' offset 448 !=3D underflow 0 arptables: Incompatible with this kernel -------------------------------------- Fixes: 09d9686047db ("netfilter: x_tables: do compat validation via transla= te_table") Signed-off-by: Hongxu Jia Acked-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/ipv4/netfilter/arp_tables.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_table= s.c index ebf5821caefb..7510a851d316 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c @@ -1330,8 +1330,8 @@ static int translate_compat_table(struct xt_table_inf= o **pinfo, =20 newinfo->number =3D compatr->num_entries; for (i =3D 0; i < NF_ARP_NUMHOOKS; i++) { - newinfo->hook_entry[i] =3D info->hook_entry[i]; - newinfo->underflow[i] =3D info->underflow[i]; + newinfo->hook_entry[i] =3D compatr->hook_entry[i]; + newinfo->underflow[i] =3D compatr->underflow[i]; } entry1 =3D newinfo->entries[raw_smp_processor_id()]; pos =3D entry1; --=20 2.14.1