Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp287582pxx; Wed, 28 Oct 2020 05:05:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVW/sRh5XDj0lgYWarmgDE0XyR14eYyNlScVW5ISIk11DlXqo5t1dN8oA0dkyuEOlkbDfU X-Received: by 2002:a17:907:960b:: with SMTP id gb11mr6689816ejc.396.1603886709772; Wed, 28 Oct 2020 05:05:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603886709; cv=none; d=google.com; s=arc-20160816; b=0BDlBpS9J4El2tDeLvqpvH+ojIw8Hl3lKI/YXf/73RfQWchdA6mFZbdAjlk1V7HF9X G2tdh6F+ZOrZf+gg9KNIv1WZ6fQt5KTNEHoqdGveOaLrctzv+SzRDp7JLZHJGdmigwUh AmU2pZ/dZ3pZzSTcfzfM1v/MzTU4xaJ8WDg+saRRTwI/UtMsIUq35tglwr2qbKc3mhyZ QGuDsmiCPsHUAOAUpwGelOKMs4/OFavVJmuRGChWV8iRCCtMZtrzfgx+PAYQlZrYIoaY gkMfKmcx/i5jeYYWRB1u7BJockanpx8TsuimVK+OjHQtHN6Kt3kmDPEGx82cKB89tBwz wUwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jOkXey1wtRIK7Jb8++OsyI0KgDLcWUgWWpsSdkQ0Uek=; b=LyytvHnfKMdpCwvPfD6LGaZWna4Q45zfBJIFInDRTPEQbLK+vYNWoWcl2K2d9W5U+7 afj+04DLhmfgcIDYRmryuJ1TFjm9L/P7IQ6fOwGjtr6ofoilgH2yho2dPRN9j6w/oMLr LVDFkKcvsktqZpixlbhQ6HpE8MjIoVJezmbcwgjZeAuEaSBKwQW22H4JZ9hIWLcgamcO 79lekV5oFvD4xsP1KahOpe56U+ZSrpF1+Oi8c5hddVWt4k5qgvbYXn6mbGsd+EiJb8ps 6iELxDuqS89m/OiRs4fSkt324xVEIzeL6V6VwP9WuQcHVqicNkx7C5ZUprWaj5SGSa4L s1gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RkUFd6Tw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si2868715ejb.712.2020.10.28.05.04.46; Wed, 28 Oct 2020 05:05:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RkUFd6Tw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1795161AbgJ0PPH (ORCPT + 99 others); Tue, 27 Oct 2020 11:15:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:45454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505295AbgJ0PJ6 (ORCPT ); Tue, 27 Oct 2020 11:09:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 9AFC320657; Tue, 27 Oct 2020 15:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811397; bh=cCBaorZKmdqODlo4rM88rfT8ZNelAO1jCRQ8rpDgCTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RkUFd6Tw0g0XexzNus2WLjMoqgVeQV/ecjtp86VLtv7q15Yaf4hdmWz47r6q/8COw pmvLtlS4a5KZhOLMkzfTYD0IIK5C9wLllz67UyQaQu5dgafna+k0tZ72V3kkpW5yYs yHJP2t9WYopl+4izqnfJUkmOx/1nqpGazon8iF9g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Timoth=C3=A9e=20COCAULT?= , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.8 477/633] netfilter: ebtables: Fixes dropping of small packets in bridge nat Date: Tue, 27 Oct 2020 14:53:40 +0100 Message-Id: <20201027135545.115866452@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Timothée COCAULT [ Upstream commit 63137bc5882a1882c553d389fdeeeace86ee1741 ] Fixes an error causing small packets to get dropped. skb_ensure_writable expects the second parameter to be a length in the ethernet payload.=20 If we want to write the ethernet header (src, dst), we should pass 0. Otherwise, packets with small payloads (< ETH_ALEN) will get dropped. Fixes: c1a831167901 ("netfilter: bridge: convert skb_make_writable to skb_ensure_writable") Signed-off-by: Timothée COCAULT Reviewed-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/bridge/netfilter/ebt_dnat.c | 2 +- net/bridge/netfilter/ebt_redirect.c | 2 +- net/bridge/netfilter/ebt_snat.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/bridge/netfilter/ebt_dnat.c b/net/bridge/netfilter/ebt_dnat.c index 12a4f4d936810..3fda71a8579d1 100644 --- a/net/bridge/netfilter/ebt_dnat.c +++ b/net/bridge/netfilter/ebt_dnat.c @@ -21,7 +21,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct ebt_nat_info *info = par->targinfo; - if (skb_ensure_writable(skb, ETH_ALEN)) + if (skb_ensure_writable(skb, 0)) return EBT_DROP; ether_addr_copy(eth_hdr(skb)->h_dest, info->mac); diff --git a/net/bridge/netfilter/ebt_redirect.c b/net/bridge/netfilter/ebt_redirect.c index 0cad62a4052b9..307790562b492 100644 --- a/net/bridge/netfilter/ebt_redirect.c +++ b/net/bridge/netfilter/ebt_redirect.c @@ -21,7 +21,7 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct ebt_redirect_info *info = par->targinfo; - if (skb_ensure_writable(skb, ETH_ALEN)) + if (skb_ensure_writable(skb, 0)) return EBT_DROP; if (xt_hooknum(par) != NF_BR_BROUTING) diff --git a/net/bridge/netfilter/ebt_snat.c b/net/bridge/netfilter/ebt_snat.c index 27443bf229a3b..7dfbcdfc30e5d 100644 --- a/net/bridge/netfilter/ebt_snat.c +++ b/net/bridge/netfilter/ebt_snat.c @@ -22,7 +22,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct ebt_nat_info *info = par->targinfo; - if (skb_ensure_writable(skb, ETH_ALEN * 2)) + if (skb_ensure_writable(skb, 0)) return EBT_DROP; ether_addr_copy(eth_hdr(skb)->h_source, info->mac); -- 2.25.1