From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6D0FC001E0 for ; Mon, 23 Oct 2023 11:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234167AbjJWLhS (ORCPT ); Mon, 23 Oct 2023 07:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234183AbjJWLhO (ORCPT ); Mon, 23 Oct 2023 07:37:14 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FFA8D7A for ; Mon, 23 Oct 2023 04:37:12 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38BEEC433CB; Mon, 23 Oct 2023 11:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698061031; bh=kaMglhRlROZ5RFXuGZAHxYepuB/tsFUgnyE5K7/h7q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y7NNX7Cg9H9ukMw3b5QG5yS7ZyHZmGG6uvG4GsTYcxzLqrC6N5T4pMtFUXXzX2EJ7 GJR1b4HT3RMs3BV/S8aGEFiGgK6AVLgLXryB3fOFoTgtgiEY8r9edlPjvtEbizKUAG gCdVmcahH8bjJAJUrUBy1POkBJK5v51XW61+TTFI= 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 5.15 022/137] netfilter: nft_payload: fix wrong mac header matching Date: Mon, 23 Oct 2023 12:56:19 +0200 Message-ID: <20231023104821.711812762@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104820.849461819@linuxfoundation.org> References: <20231023104820.849461819@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.15-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 @@ -133,7 +133,7 @@ void nft_payload_eval(const struct nft_e 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)) {