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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A4ACC11F6B for ; Fri, 2 Jul 2021 00:56:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 228B7613F4 for ; Fri, 2 Jul 2021 00:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234641AbhGBA7X (ORCPT ); Thu, 1 Jul 2021 20:59:23 -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.