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 C2F0EC004C0 for ; Mon, 23 Oct 2023 11:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbjJWLFE (ORCPT ); Mon, 23 Oct 2023 07:05:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233225AbjJWLFD (ORCPT ); Mon, 23 Oct 2023 07:05:03 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD0FD7B for ; Mon, 23 Oct 2023 04:05:00 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B41CC433C8; Mon, 23 Oct 2023 11:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698059100; bh=hy4FULOZm4VWNiWJRYf9lf+yZYOfTs5CYDlAIeSR6z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O4wlZI0Et/P/8ijAMfArd+BDnBH/Us5nMTGg2/aiIOfgq5YkOIdZpazyOVUP/H1w5 MsYRxIdams30V8q7fIqymzik93UBwrnRc8w6ewPoCViC+XClpW1hOZszapaCf/FhQz idOzFnMwSVdDDkUfZU2AwGBe9TSmHAkMmeghcHvM= 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 6.5 036/241] netfilter: nft_payload: fix wrong mac header matching Date: Mon, 23 Oct 2023 12:53:42 +0200 Message-ID: <20231023104834.803759372@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104833.832874523@linuxfoundation.org> References: <20231023104833.832874523@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 6.5-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 @@ -179,7 +179,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) &&