Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4815018yba; Tue, 30 Apr 2019 04:59:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAsG0USAXP8fhxoHRIdW4MqX+93TKjDH6wmvVAz2Jh2sxeMS1DubRQqM3CfTi0HmAfK0Dl X-Received: by 2002:a63:4558:: with SMTP id u24mr62864556pgk.225.1556625553122; Tue, 30 Apr 2019 04:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625553; cv=none; d=google.com; s=arc-20160816; b=sfCJCDigg33dG0Rn4rBGeWLfA2YM5Y8kpfcwbr8RsVbJ8sHQewZcYtq7aMX60Zr1rh 7ZKQiB8vCNneuNH0u0lJ8XrbyU2obzZoVIP3Nk6dYvOZM1tFaEio1fTL1z7A9cGUe7FA c/j+ejKZVOekYT3zRSVdI+R0Bc1/cmokg0pN09VFknHPrZ41dSR1qUydd7vD6ljjGubw dfKph9FI2gxTYJdsD8rWW6cwb/YV0lkn4GnSrxoLEVIx8SUybx4FnApG1vyBcTbtrr9A TabGd9JGh9cR7vzl/+hXh0hx4swVluii11eqNF8mX0TTdcBRxOVG5vqeGwWi71yKfufE BN/A== 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=nWdyfbY+gtjxdQ+vPC8V7JwgnseTvFrK4kqRKlsi8ZU=; b=XiiIoLfBTz4Tv4hPzt92nOICtJBLikne/s8Y4tn4gNazUwxjBrpoMe26Wtbtpjq5iK E+9pkm0ogj83kFdHWAaGwMJAer4qJa7RvbrYfm64My2ipGPHzqB28ovSTTHvVxDf88KW Czrgqa3QplpUVzr35M+6ok3+Tlg8Ncml/lzFFP4v/JBH0qe+9qOVYrN+Zj8MtgKJjrmy JwBK6lRUBx2pv/gE2WBLjbu7uEvngVVQZk2EP+2udRAYFSydZ0pz51DDo3yTbpZUBw8V A9GPnskgjIlOcQ0/jcnZ0ZZiWBBZaiA5rFfnVRazeBSK+hNTEXtdvFqjUAOzck2ZVubq SFcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zUOtV+tX; 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 r197si13875740pfc.247.2019.04.30.04.58.58; Tue, 30 Apr 2019 04:59:13 -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=zUOtV+tX; 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 S1727470AbfD3L5V (ORCPT + 99 others); Tue, 30 Apr 2019 07:57:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:34018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728926AbfD3LsH (ORCPT ); Tue, 30 Apr 2019 07:48:07 -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 B1B0C2054F; Tue, 30 Apr 2019 11:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624886; bh=17cVRuU6W8q7VjDf23UMfIcNffAFqd8hJoMrPf6lOa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zUOtV+tXxNPfWTaJdWPuhe7xr8vABRP+ix5D2MhZ3heD0WHhZDfoYuWzzTB8Y1lVl TDbphLE+vgNihQmBlk2IBnbXN/6sKtMJThrXdAVyftA/wZzI24qQU/tvZ6F9vOP6tY YHEVPmynbUiA9KGK8qGS7NoH4hZujciiGPQkgvxc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laura Garcia , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.0 02/89] netfilter: nf_tables: bogus EBUSY in helper removal from transaction Date: Tue, 30 Apr 2019 13:37:53 +0200 Message-Id: <20190430113609.924618319@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113609.741196396@linuxfoundation.org> References: <20190430113609.741196396@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 [ Upstream commit 8ffcd32f64633926163cdd07a7d295c500a947d1 ] Proper use counter updates when activating and deactivating the object, otherwise, this hits bogus EBUSY error. Fixes: cd5125d8f518 ("netfilter: nf_tables: split set destruction in deactivate and destroy phase") Reported-by: Laura Garcia Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nft_objref.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nft_objref.c b/net/netfilter/nft_objref.c index d8737c115257..bf92a40dd1b2 100644 --- a/net/netfilter/nft_objref.c +++ b/net/netfilter/nft_objref.c @@ -64,21 +64,34 @@ nla_put_failure: return -1; } -static void nft_objref_destroy(const struct nft_ctx *ctx, - const struct nft_expr *expr) +static void nft_objref_deactivate(const struct nft_ctx *ctx, + const struct nft_expr *expr, + enum nft_trans_phase phase) { struct nft_object *obj = nft_objref_priv(expr); + if (phase == NFT_TRANS_COMMIT) + return; + obj->use--; } +static void nft_objref_activate(const struct nft_ctx *ctx, + const struct nft_expr *expr) +{ + struct nft_object *obj = nft_objref_priv(expr); + + obj->use++; +} + static struct nft_expr_type nft_objref_type; static const struct nft_expr_ops nft_objref_ops = { .type = &nft_objref_type, .size = NFT_EXPR_SIZE(sizeof(struct nft_object *)), .eval = nft_objref_eval, .init = nft_objref_init, - .destroy = nft_objref_destroy, + .activate = nft_objref_activate, + .deactivate = nft_objref_deactivate, .dump = nft_objref_dump, }; -- 2.19.1