From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamal Hadi Salim Subject: Re: [PATCH net-next v4 1/2] net sched actions: Add support for user cookies Date: Wed, 18 Jan 2017 06:35:29 -0500 Message-ID: <43669d61-d73b-416e-95e5-24d43cdceca1@mojatatu.com> References: <1484651509-27500-1-git-send-email-jhs@emojatatu.com> <1484651509-27500-2-git-send-email-jhs@emojatatu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: David Miller , Linux Kernel Network Developers , Jiri Pirko , paulb@mellanox.com, John Fastabend , Simon Horman , Roman Mashak , Hadar Har-Zion , Or Gerlitz , Roi Dayan , Daniel Borkmann To: Cong Wang Return-path: Received: from mail-qt0-f195.google.com ([209.85.216.195]:36599 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635AbdARLn5 (ORCPT ); Wed, 18 Jan 2017 06:43:57 -0500 Received: by mail-qt0-f195.google.com with SMTP id l7so1224493qtd.3 for ; Wed, 18 Jan 2017 03:43:57 -0800 (PST) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On 17-01-17 01:40 PM, Cong Wang wrote: > On Tue, Jan 17, 2017 at 3:11 AM, Jamal Hadi Salim wrote: >> @@ -575,6 +583,23 @@ struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla, >> if (err < 0) >> goto err_mod; >> >> + if (tb[TCA_ACT_COOKIE]) { >> + if (nla_len(tb[TCA_ACT_COOKIE]) > TC_COOKIE_MAX_SIZE) { >> + err = -EINVAL; >> + goto err_mod; >> + } >> + >> + a->act_ck = kzalloc(sizeof(*a->act_ck), GFP_KERNEL); >> + if (unlikely(!a->act_ck)) { >> + err = -ENOMEM; >> + goto err_mod; >> + } >> + > > I am afraid you can't just goto err_mod for error case here, b/c ->init() > is already called before this, you probably either have to call ->destroy() > for error path, or move this before ->init(). > Thanks for catching this. Deserves a respin. Easier to move it earlier. cheers, jamal