From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71864134C3 for ; Mon, 23 Oct 2023 11:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="a7xxINn6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0CBAC433C9; Mon, 23 Oct 2023 11:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698059784; bh=8O8DpQW3Vk/K1j40b4Krc3dbR5mpPexD9KXO2VVquLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a7xxINn63JmYko7fo7HTxfKWqYYIYWKK63C012F0/txBseuKtzJkCOWIqlGKRJa92 LE1tkbJFAFsNdp0J4jb9MYSFP7yBOxbZO4ih0E5H0tXZV132B3GgoGgMk1GNIufpKd OHxhcCiFDdq/Ao0I3sa/eO61oTXCNffb4bXgw4r8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Bla=C5=BEej=20Kraj=C5=88=C3=A1k?= , Florian Westphal Subject: [PATCH 4.19 51/98] netfilter: nft_payload: fix wrong mac header matching Date: Mon, 23 Oct 2023 12:56:40 +0200 Message-ID: <20231023104815.415066188@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104813.580375891@linuxfoundation.org> References: <20231023104813.580375891@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal commit d351c1ea2de3e36e608fc355d8ae7d0cc80e6cd6 upstream. mcast packets get looped back to the local machine. Such packets have a 0-length mac header, we should treat this like "mac header not set" and abort rule evaluation. As-is, we just copy data from the network header instead. Fixes: 96518518cc41 ("netfilter: add nftables") Reported-by: Blažej Krajňák Signed-off-by: Florian Westphal Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nft_payload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/netfilter/nft_payload.c +++ b/net/netfilter/nft_payload.c @@ -84,7 +84,7 @@ static void nft_payload_eval(const struc switch (priv->base) { case NFT_PAYLOAD_LL_HEADER: - if (!skb_mac_header_was_set(skb)) + if (!skb_mac_header_was_set(skb) || skb_mac_header_len(skb) == 0) goto err; if (skb_vlan_tag_present(skb)) {