Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1118110pxv; Thu, 1 Jul 2021 17:59:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUd2kW/+F17ePDVvZpHSbkT48L76j8ZSKMSm2mMYi6sm8bw9VtL8SkE6rboiggIu+UiKfT X-Received: by 2002:a92:a004:: with SMTP id e4mr574582ili.299.1625187593944; Thu, 01 Jul 2021 17:59:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625187593; cv=none; d=google.com; s=arc-20160816; b=t9NHyXi5m2l2rDyAgLFMltiAN8JZbiNftuFahoof2dXd8swV3So6Fcy/64ZLGnFgJK 9b9w9s63awrRo8Wg6k+Kuv93FHMmEUde7+Uy0elxkIa1ngMb1jXIxBcSTJyQy0nTYnCS vXwKM6aSHtmwRweuvcvtwyV3mJyTy0G7AYoSV+bKHFuQQgujkLARQ6TnnrWeotXJo2sT a/s4Mej6wKaOC0uc0A6KNKr+o38kTHlB2Y/8rG4tgFE1FtByMqFn81hlKZ5dE4xRClcW aCFBdyzWlwHbOHhwsfX/rHiQnMTV9ynZziHQ9kjeHqn/kuxjY7KA39p4KIoE5D+aXAf/ smaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=nF7tMgFGoyrVnEQ7ov2L2miyNFElnY7taHV9W5i9e0U=; b=luilcR0DW9yHzYGXqfKbZlz4ZlzPtI1nup50MyCpJYAMkfcSDg43qjD/shWQllkDNE rjdqOyo9hywumNpvKqL6sA2d7lpUisRrPsmQQrbzjX6gxQL/uDLFp1L7LPtDW7QbtX1Y o4X2S4s0XDOTq8Ih0t5FlX10W8TGyaJ9X+4iEp9r0GbnrehlpyXlVh9rHIabNeqQwHJP A4SJ8p7X3VZdFK+QvR82v/+PW5DTwLdrO/zzrfbHkkxw7867P24KJOpORsK2xuz5jETr lK0rtL/jE1DadlJN2boDwN7tm5ntO3OefxhcL3cdvI24lGMiPcg8L6gdCwuz/CKYaQNr qWtg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p21si1622854jal.21.2021.07.01.17.59.42; Thu, 01 Jul 2021 17:59:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234614AbhGBA7W (ORCPT + 99 others); Thu, 1 Jul 2021 20:59:22 -0400 Received: from mail.netfilter.org ([217.70.188.207]:42048 "EHLO mail.netfilter.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234370AbhGBA7W (ORCPT ); Thu, 1 Jul 2021 20:59:22 -0400 Received: from netfilter.org (unknown [90.77.255.23]) by mail.netfilter.org (Postfix) with ESMTPSA id 6A7CC60705; Fri, 2 Jul 2021 02:56:43 +0200 (CEST) Date: Fri, 2 Jul 2021 02:56:48 +0200 From: Pablo Neira Ayuso To: Colin King Cc: Jozsef Kadlecsik , Florian Westphal , "David S . Miller" , Jakub Kicinski , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] netfilter: nf_tables: Fix dereference of null pointer flow Message-ID: <20210702005648.GC29227@salvia> References: <20210624195718.170796-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210624195718.170796-1-colin.king@canonical.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021 at 08:57:18PM +0100, Colin King wrote: > From: Colin Ian King > > In the case where chain->flags & NFT_CHAIN_HW_OFFLOAD is false then > nft_flow_rule_create is not called and flow is NULL. The subsequent > error handling execution via label err_destroy_flow_rule will lead > to a null pointer dereference on flow when calling nft_flow_rule_destroy. > Since the error path to err_destroy_flow_rule has to cater for null > and non-null flows, only call nft_flow_rule_destroy if flow is non-null > to fix this issue. Applied, thanks.