Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp482696imm; Tue, 15 May 2018 04:45:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrxB1CmgPbCVt8+QM1ZMHQs9KIWEzPXv5vCDz9sqBmU3oKJb5yn4XPJivLtiVTx3uQXishn X-Received: by 2002:a62:6c87:: with SMTP id h129-v6mr14636033pfc.179.1526384755892; Tue, 15 May 2018 04:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526384755; cv=none; d=google.com; s=arc-20160816; b=dPwmmlf01yDxmisXC54WSznYecXlR0YyRuo8eF5CpUkT1pOSNiFxkrAz0uzc9l+5tL NMuu8NDMVypFvEY1CGSw+hgn2QbKzuembrjg6k3eYJNTNxEETbLVE6T48HUrWIHzjiYi ZBGzTPVuOLEbLelxqZYYULNedwNFQrSz6hFtf6t/OlY7IK1iKEKrHQTXiT5I+t8R2+YK 7CszC3zBZpuYtTScaILpy3CGLgo9GvfKpBkYAm6IVpfdVSmKOvfPLpLl/qMFX9PlxsRV 6x6D6RoleqrYsC8DtjM2vYsLeczlCi59gI5/+vy1DcV9BlIETIaOfY/YbpKKyMDCV0UK m4PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Li0oRKnUzW99Zd2DVzGpSVbWJMSiPREus9pHfrjfk5E=; b=L3s9j57PnAEfnNLKJ7T7giOMgTvku+HdOzHQcxgdkTwKpV3KJgxXkxL/VvNoPTisYd i7h5h22fDqQkMFyrKeH0Wr2BaDyqrSPPumFgJ4ptJ3MgM+a3lkTLYC884KX8Jtq8Tf5f 6iCnxnsKSwrNJ52ZYTqHVxHAmN3vUH1tt9SDc5OVZnDb3AgE9y+iKaqgJf8TfKN3cuGe Fkpkbzl0HmNHh0EQKWGk0IEn5DKOBZb6noD9kM9uECVZrF074l6wEv+M95y8lz2b9DaN LbbwXtwsYy4Ep2DLC8rrJiScyh9Qe+ovfUGVJC4Rb03284h5dye7HGqcSy4Qr3YP+N6e anGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=c2z0/0QJ; 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 b77-v6si11997952pfc.320.2018.05.15.04.45.25; Tue, 15 May 2018 04:45:55 -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=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=c2z0/0QJ; 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 S1752879AbeEOLj6 (ORCPT + 99 others); Tue, 15 May 2018 07:39:58 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35544 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752831AbeEOLj4 (ORCPT ); Tue, 15 May 2018 07:39:56 -0400 Received: by mail-wr0-f195.google.com with SMTP id i14-v6so15667845wre.2 for ; Tue, 15 May 2018 04:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Li0oRKnUzW99Zd2DVzGpSVbWJMSiPREus9pHfrjfk5E=; b=c2z0/0QJDbuBYlg2TJvKzq4TsthDl8lr6YEQCt0ZdVOH4LiOCkzlaV2L6G+xvOCIoG dl35wbOSLrbSaRF8xqrvt1TFXLb/1zaqW5mSPa9Ktbf4mPXgscaVERUF9qD7X1sNyp7O XkblGHAaYCo1n1RL3JFKZcP3crJdsb0Jz44xxBol6E3PCEeBNBLCFzE5HRNbXsbrLgMt 9GJJfVqoDh22oTnEiZFiKPlZSc8ltgIrip9vCK/5Wbi3QaQcd+dJa0n07AO1It/pC7p5 jz6yltvDGiII7vTG8StyXBr33e58LFiT0a8flPOuMn0q8TCrliSYM/7R67akuwXBFYvo XsBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Li0oRKnUzW99Zd2DVzGpSVbWJMSiPREus9pHfrjfk5E=; b=rphmBRqUYNbF8a/h+YuU5u3eq3TF8h/TcQK2Ilw1txxbzBOXqWzzbsxIMhQVwxzug+ QQONn4y0zseSuwboHMqJEHauvU4rf8nJ1BvPub8aNDsU/+3jJMQco+H5/NWKbpv8PVnG uQ+CMgKZAysa/timYFtofhezhXJFUXTwEjLpzvop7Po1QxZ0jo5W5NjHqPW9BE4Fmhsx k+2h/g+pRwaX9K2jjA3w4zD/M+uF/9kuk1/+AQQdCmA41sESnWXlDtbf/Kd+Jl38cvnm 3QuiE52P4HFIOXhEsB0u3VY8bJ4tCDN847CpBzob7GVyHSm8as9RXEeWRlgq2quZSIci 5H9w== X-Gm-Message-State: ALKqPwcaLwl3XZ+xfBN43IXCBO8texpl5XYrzjsIbxCfYuOLfUYgDu2u mB41UtCSg2aHFv0BQmLa2881Cg== X-Received: by 2002:adf:86ed:: with SMTP id 42-v6mr10964008wry.158.1526384395517; Tue, 15 May 2018 04:39:55 -0700 (PDT) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id x24-v6sm182471wmh.18.2018.05.15.04.39.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 04:39:55 -0700 (PDT) Date: Tue, 15 May 2018 13:39:54 +0200 From: Jiri Pirko To: Vlad Buslov Cc: netdev@vger.kernel.org, davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, pablo@netfilter.org, kadlec@blackhole.kfki.hu, fw@strlen.de, ast@kernel.org, daniel@iogearbox.net, edumazet@google.com, keescook@chromium.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, kliteyn@mellanox.com Subject: Re: [PATCH 07/14] net: sched: use reference counting action init Message-ID: <20180515113954.GM2134@nanopsycho.orion> References: <1526308035-12484-1-git-send-email-vladbu@mellanox.com> <1526308035-12484-8-git-send-email-vladbu@mellanox.com> <20180515112404.GL2134@nanopsycho.orion> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tue, May 15, 2018 at 01:32:51PM CEST, vladbu@mellanox.com wrote: > >On Tue 15 May 2018 at 11:24, Jiri Pirko wrote: >> Mon, May 14, 2018 at 04:27:08PM CEST, vladbu@mellanox.com wrote: >>>Change action API to assume that action init function always takes >>>reference to action, even when overwriting existing action. This is >>>necessary because action API continues to use action pointer after init >>>function is done. At this point action becomes accessible for concurrent >>>modifications so user must always hold reference to it. >>> >>>Implement helper put list function to atomically release list of actions >>>after action API init code is done using them. >>> >>>Signed-off-by: Vlad Buslov >>>--- >>> net/sched/act_api.c | 38 +++++++++++++++++--------------------- >>> 1 file changed, 17 insertions(+), 21 deletions(-) >>> >> >> [...] >> >> >>>@@ -1196,8 +1190,7 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, >>> return ret; >>> } >>> err: >>>- if (event != RTM_GETACTION) >> >> Howcome you do this for RTM_GETACTION now too? Where is the related >> "get"? > >In patch 5. There is always a possibility of concurrent delete without >rtnl lock so all usages of action pointers were converted to hold >reference to action. So that means that if you run kernel in between, with patch 5 but without patch 7 and you do RTM_GETACTION, you leak a reference, right? > >> >> >>>- tcf_action_destroy(&actions, 0); >>>+ tcf_action_put_lst(&actions); >>> return ret; >>> } >>> >> >> [...] >