Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp495101imm; Tue, 15 May 2018 04:58:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo8wDMyfxFrmg+vYHs1X1Tb2TuzWjSYpc2ClOpBLpd91xXJzSRkQXpUdYYdtd9mPxqbkl6s X-Received: by 2002:a65:4a46:: with SMTP id a6-v6mr12108059pgu.227.1526385493855; Tue, 15 May 2018 04:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526385493; cv=none; d=google.com; s=arc-20160816; b=qBbmIKn0UJVGaZ4oysOzW4mSegDDSDCgVq0TSxAzcV+dvR7/9EFv8oxG54T61ZFce7 W3PK2UiaUFBFIwWUD1Pu6f5yISttHEWoM/3P+RJHeIolK+3BtKFToZi8BRgu4W2w3nj1 JCCVpB+oA7Pejo00WDbtrPgqIpWr4lVmLzZg9Uhi3zFVNBV61GFMxvcff8F+RNVjgmQj kslZzfi6h6VmVEHcnKAlrdkMChntNCJZ5MsIrmcqMh0nrOrGberqNTMpK1BtWLic0ED4 +5257xf46dpQVj0SOMLzsUgdq+Sxgv0w1+SI25wF1zv4jTlx2DV0ksrnU+xvxatLbrNy lztg== 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=F3xxtRKV/QSDsujnRpA5CHkX/MIGE3aS35CSSN2QAM4=; b=GxTbEXJkcxPY2m+9bjn0A4nqCFlx29MlMmx8340irnyn0OSVgT54+nICTX6vgeNXMv ctTiIEEwDMt2+LZRp+LLJXmdYVivzFoX3h6a4g9g/ddm+dmRHtUE8OTj72DJdUKcQ7o+ n6mFcJdE6FvyhYwb3ec9rW3u2oMhuRtg+KMamrN72Na9ivRX1OdVvZ+g7r0m+lX376ou qnuQNBbOmCnRgXLpYvYCulTtRmzjhYLrNdGvZGD59ZqN0RzpB6BiZhqTYTc813IGKp4A oDltmJia5mIxac4/Cnf26orrQ7js9OkfClZ29sXi8yn2Pp36zlDkoLB17xRsdTSQ8q64 512Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=JLghcqTU; 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 u4-v6si2287032pgc.223.2018.05.15.04.57.59; Tue, 15 May 2018 04:58: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=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=JLghcqTU; 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 S1753007AbeEOL5n (ORCPT + 99 others); Tue, 15 May 2018 07:57:43 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33780 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752906AbeEOL5l (ORCPT ); Tue, 15 May 2018 07:57:41 -0400 Received: by mail-wr0-f194.google.com with SMTP id o4-v6so15733206wrm.0 for ; Tue, 15 May 2018 04:57:41 -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=F3xxtRKV/QSDsujnRpA5CHkX/MIGE3aS35CSSN2QAM4=; b=JLghcqTUyFihJM0RWd/Nhq5yr+eLQvPA3Z6crsCv1Un7VcrgVYg+gm+XgLx8IU1n+4 Z9M2E1aDQFgaZMPZ3zASm9tPoVXN7P1r20UzyeeL0lLU5PMZawJxpHgeNTppdA8bpXxX gfTYjfBkgJB1F84FHWK0ha/blQVzcx6E11I4T0qOSUn4mZOQBxYb+XBCsekbnMhTdDmz JHI4XaNO57l0rXEvLm4ytOPiwFxxrdbe6zRVUoHjqC83hE+EubFjZ2wXewd+dqFhDhO1 Rmr13og2J9hlvDeJsmFK+KBJG6DeJT4KP0/2P8jCIdjTwrGuH8yPhiTigFyJ85xJ3ftJ 2wkg== 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=F3xxtRKV/QSDsujnRpA5CHkX/MIGE3aS35CSSN2QAM4=; b=EamMgmH6FLheV61o+r/Fb5RjJb+4VLc+Q+DgRDGrU3FHE0WClEgcKVK6fM3hj1Bs0j +tIx4zDyuZmW1pyESzu2rcJ/I5CrE4TLfi5JuXt39XaU7400Lc6GeBVpoFOpO1DWJXuI uqvtnLkD63mVijOVXdpl7bcpCzA5ZF/C0sR+I14fGmzw3awiBUIIcXFs0yyBR42BFdF4 rAKzO2cb3e6tP6s//b0QkkXHJf/dRPXjSKa9kMAijmy6s0FtU8B5KfOqbHqjI2qnMmLz XSbPRs7Yla6hTwmJ3QdTXkXJ2hPUB4AbtWuEAgM+Kf97e4zU3ZvI5LN2Po54/ahrBxIk cddg== X-Gm-Message-State: ALKqPwd67ihYcs9c2EMR+k6+hBzCXO5ZO5yUxjp0YUlRIQ9DiQDNdUVn ozkEuszz/T06KBMDqpDrk8mBhQ== X-Received: by 2002:adf:86ac:: with SMTP id 41-v6mr9800673wrx.260.1526385460510; Tue, 15 May 2018 04:57:40 -0700 (PDT) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id u68-v6sm290145wmu.40.2018.05.15.04.57.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 04:57:39 -0700 (PDT) Date: Tue, 15 May 2018 13:57:39 +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: <20180515115739.GN2134@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> <20180515113954.GM2134@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:41:45PM CEST, vladbu@mellanox.com wrote: > >On Tue 15 May 2018 at 11:39, Jiri Pirko wrote: >> 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? > >Right. That is an issue. You need to make sure that the code is without bugs like this after every applied patch. You need to make sure the code is bisectable. Thanks.