From patchwork Thu Oct 19 08:18:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 827971 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yHhft0g5Fz9t3n for ; Thu, 19 Oct 2017 19:19:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752273AbdJSITd (ORCPT ); Thu, 19 Oct 2017 04:19:33 -0400 Received: from orbyte.nwl.cc ([151.80.46.58]:49454 "EHLO orbyte.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752301AbdJSITd (ORCPT ); Thu, 19 Oct 2017 04:19:33 -0400 Received: from localhost ([::1]:43994 helo=xsao) by orbyte.nwl.cc with esmtp (Exim 4.89) (envelope-from ) id 1e5639-0003q2-Uq; Thu, 19 Oct 2017 10:19:31 +0200 From: Phil Sutter To: Pablo Neira Ayuso Cc: Eric Leblond , netfilter-devel@vger.kernel.org, Florian Westphal Subject: [nft PATCH 1/7] nft_ctx_free: Fix for wrong argument passed to cache_release Date: Thu, 19 Oct 2017 10:18:41 +0200 Message-Id: <20171019081847.16171-2-phil@nwl.cc> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20171019081847.16171-1-phil@nwl.cc> References: <20171019081847.16171-1-phil@nwl.cc> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org nft_ctx_free() should not refer to the global 'nft' variable, this will break as soon as the function is moved away from main.c. In order to use the cache reference from passed argument, the latter must not be const. Signed-off-by: Phil Sutter --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index b59c932ad4299..1b26838058a4a 100644 --- a/src/main.c +++ b/src/main.c @@ -305,13 +305,13 @@ static struct nft_ctx *nft_ctx_new(uint32_t flags) return ctx; } -static void nft_ctx_free(const struct nft_ctx *ctx) +static void nft_ctx_free(struct nft_ctx *ctx) { if (ctx->nf_sock) netlink_close_sock(ctx->nf_sock); iface_cache_release(); - cache_release(&nft->cache); + cache_release(&ctx->cache); xfree(ctx); nft_exit(); }