From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [PATCH net] cls_bpf: don't decrement net's refcount when offload fails Date: Mon, 27 Nov 2017 22:09:33 +0100 Message-ID: <9a326b7b-d80c-9d52-aba5-128dcd5b7778@iogearbox.net> References: <20171127191141.5949-1-jakub.kicinski@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: oss-drivers@netronome.com, Cong Wang To: Jakub Kicinski , netdev@vger.kernel.org Return-path: Received: from www62.your-server.de ([213.133.104.62]:39128 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751608AbdK0VJf (ORCPT ); Mon, 27 Nov 2017 16:09:35 -0500 In-Reply-To: <20171127191141.5949-1-jakub.kicinski@netronome.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 11/27/2017 08:11 PM, Jakub Kicinski wrote: > When cls_bpf offload was added it seemed like a good idea to > call cls_bpf_delete_prog() instead of extending the error > handling path, since the software state is fully initialized > at that point. This handling of errors without jumping to > the end of the function is error prone, as proven by later > commit missing that extra call to __cls_bpf_delete_prog(). > > __cls_bpf_delete_prog() is now expected to be invoked with > a reference on exts->net or the field zeroed out. The call > on the offload's error patch does not fullfil this requirement, > leading to each error stealing a reference on net namespace. > > Create a function undoing what cls_bpf_set_parms() did and > use it from __cls_bpf_delete_prog() and the error path. > > Fixes: aae2c35ec892 ("cls_bpf: use tcf_exts_get_net() before call_rcu()") > Signed-off-by: Jakub Kicinski > Reviewed-by: Simon Horman Fix looks good to me, thanks Jakub! If Dave wants to take it directly: Acked-by: Daniel Borkmann