Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7150929ybi; Mon, 8 Jul 2019 15:40:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHJSOEv1FnvXpUdX6JGsOAUKNQoaeI/DGMGgLxEb6wYr4AuWouf4Zd40ADow7wQHsYSPA4 X-Received: by 2002:a63:f44a:: with SMTP id p10mr26876763pgk.148.1562625617546; Mon, 08 Jul 2019 15:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625617; cv=none; d=google.com; s=arc-20160816; b=xXVYTxWHa30mBwToAIKKQVevUzpP+NYzJCWq5e7UrN1BbH7S1L5FVh3yJbUlbY2H2h gLaxKis7ODFWGHOZF2Z7S+33WyWQUxNWiZZReuC9xipQ/jvjLDr7W3W+z66GVpaDarRx xZE1E/pMZMlE4drylsKUJ/OVtilNtYlEdDtVmh/W410XCNRuUcux64m3BUzASSSN1cq5 0UkSQADt2Gn84K6pCbCBitqaBSBdsL2lnvg+VCnFU4Ql5rvaFS6snDvXmpmdkrndIxVy eayYLVvhT8zn4HOHO3O7r83jhEdKK0syV5ZV4zUji94FdwhWgbGIuQiAzmR8Z/xiPhsB pFpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TtPh6fzCvdOhaSmc6nHhuYRRUAg5SxEYjPLlGPEu2hg=; b=abx3kCCf1r7PuxIyDlplQ7n3ULVI+AgaESUu149r28WuFXlPfYKsN98ExZfLzC+hBf QBim3v4QKkpDnG5cXjjj91lQNSvnlzHkBXB+rRzmYHde1NVzyUILWzSu5gNPHL2gQp7x /PHa/RDRe29RtX+S4UvU8od71Eu1BSkZLu7s2bi9CNSILVgwBIw4wI/llO1PiMrPKGPu K9/SieTTiBUPFDC5/h98IC5OxTdCEBg5DTG55JoaPiPKsErI+7uHZi0+rVJwxQmk5u/g EhwK02ijnT65Hnhf9o4olc0nS2/NeWMVnJuvMcR8sg4CBd0lKCYhHi8XTtphQXaGYhXX dYNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yfQn6qUR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z17si718601pjr.21.2019.07.08.15.40.02; Mon, 08 Jul 2019 15:40:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yfQn6qUR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390966AbfGHPhN (ORCPT + 99 others); Mon, 8 Jul 2019 11:37:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:34312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390164AbfGHPcf (ORCPT ); Mon, 8 Jul 2019 11:32:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D4A38216F4; Mon, 8 Jul 2019 15:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599954; bh=H0IXspXxI/zpi03RBWqNoqskzumzNpuQhM1IWR1zcxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yfQn6qURwjFU9RiU5QkLgUOLudQOWPm0cBCVbo9kOuYQbPQrjJOeGvotn5AQlNy9D e+MlVT3tMKe9h2hiKAOC2iBj8R7EnoxGtxVLeb4EEg5hEgNVqJURAHvOeOYxhQa7Sl vXOOp9ykrYkJiW46Y4KHs9FT4y61OQklH6LT4DI8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.1 06/96] netfilter: nft_flow_offload: IPCB is only valid for ipv4 family Date: Mon, 8 Jul 2019 17:12:38 +0200 Message-Id: <20190708150526.644612063@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150526.234572443@linuxfoundation.org> References: <20190708150526.234572443@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Westphal commit 69aeb538587e087bfc81dd1f465eab3558ff3158 upstream. Guard this with a check vs. ipv4, IPCB isn't valid in ipv6 case. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nft_flow_offload.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) --- a/net/netfilter/nft_flow_offload.c +++ b/net/netfilter/nft_flow_offload.c @@ -48,15 +48,20 @@ static int nft_flow_route(const struct n return 0; } -static bool nft_flow_offload_skip(struct sk_buff *skb) +static bool nft_flow_offload_skip(struct sk_buff *skb, int family) { - struct ip_options *opt = &(IPCB(skb)->opt); - - if (unlikely(opt->optlen)) - return true; if (skb_sec_path(skb)) return true; + if (family == NFPROTO_IPV4) { + const struct ip_options *opt; + + opt = &(IPCB(skb)->opt); + + if (unlikely(opt->optlen)) + return true; + } + return false; } @@ -74,7 +79,7 @@ static void nft_flow_offload_eval(const struct nf_conn *ct; int ret; - if (nft_flow_offload_skip(pkt->skb)) + if (nft_flow_offload_skip(pkt->skb, nft_pf(pkt))) goto out; ct = nf_ct_get(pkt->skb, &ctinfo);