Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp518919pxx; Wed, 28 Oct 2020 10:09:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOdYH+r/haxjaTm8Jg2JEaMzgO88YLj5ACxTxNs22Lb/cUy4YcYtkgo9MaW9goO3QfuFi3 X-Received: by 2002:a50:871d:: with SMTP id i29mr8933731edb.300.1603904964851; Wed, 28 Oct 2020 10:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603904964; cv=none; d=google.com; s=arc-20160816; b=I9ylNj16iBq/M+9xs1mlpHcz0ivwd2MxQhd6YZqXbPMw3bGT57dny4W2K8ZnB1X7el Yr6i/4miU/OLK8O+Lv+dpHvNnoZGCCTtK0bKC26Fvq0t3EzkDQvObtlFbRdp25E93Q0+ 4Kf076bFEeC2buzqx05XXcYRK9teFu3nq1P18y4apioqOgjxcmaf+Why6AdjlMNZh9BG /GKqGSgkD/WDtCR88I1K+VsBnNLYqYCYJ24J8WDEJXT4JwctzpCA7R9eHu2jhBnuycG0 CQrKoue15DPqBR+VCZoSeEqW1NddIncgXUlZSvxJ1/VSGCAyD2/977EPHpWWnJOjrTHJ 2XgA== 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=dda3s+Cqao51cNtKKbKAuiFMhHhvt6izAiYaVnit86eNw9SvntD5lHrMXaZBEJO64L 3vQEQUVxoCA+HH/Am5lBYhW8x6HILX3YBcgw3DQtpOMOmR9ZqS8XctNyjYl5Lc+eITH7 W2hNssFR7PriLH0FIGrBloMuOzkmYDUmzTk2qLGybE0fHsEz4CZs2bWluf5l+zJKPqHg HyP1EIPQx8VEUPsHINYy9BZNeWRYLKb8MIoME38rjohFoWPQ9q1u4FngIxTkbghaAYnz 2RIIqPhNP9rOhoAt8IEQ+b/VVQtxjzex0Wl6AyWR1UGHVRoNlw3+up8jEQThYXlESTws QJFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h8MCfu2o; 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 bu23si3659073ejb.83.2020.10.28.10.08.58; Wed, 28 Oct 2020 10:09:24 -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=h8MCfu2o; 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 S2895097AbgJ0Rdc (ORCPT + 99 others); Tue, 27 Oct 2020 13:33:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:41308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762294AbgJ0Olw (ORCPT ); Tue, 27 Oct 2020 10:41:52 -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 B086A20773; Tue, 27 Oct 2020 14:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809711; bh=cCBaorZKmdqODlo4rM88rfT8ZNelAO1jCRQ8rpDgCTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h8MCfu2oUXK6ym55EUCC8/eeabQyQ+OENHMUGpHPuAL+6CP12HQyNPP98UFs+Gc31 uQSbNAdsi6WjE2NwqPyBKkNJvjoTTBVMxFVBI7siQDfwyLFWvFwPph7P2PWuESXPoC XAg6OJKgKxVogr29HvmxGZdG1yZu+WfT2hyHM0JI= 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.4 293/408] netfilter: ebtables: Fixes dropping of small packets in bridge nat Date: Tue, 27 Oct 2020 14:53:51 +0100 Message-Id: <20201027135508.632625002@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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