[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85inm8pgtc.fsf@mojatatu.com>
Date: Thu, 13 Apr 2017 09:39:43 -0400
From: Roman Mashak <mrv@...atatu.com>
To: Wolfgang Bumiller <w.bumiller@...xmox.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Jamal Hadi Salim <jhs@...atatu.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH linux 2/2] net sched actions: fix refcount decrement on error
Wolfgang Bumiller <w.bumiller@...xmox.com> writes:
> If memory allocation for nla_memdup_cookie() fails
> module_put has to be guarded by the same condition as it was
> before the TCA_ACT_COOKIE has been added as stated in the
> comment afterwards:
>
What if a new entry has been created, and a_o->init returns
ACT_P_CREATED, but cookie allocation fails, do we not remove module
reference count?
[...]
> if (cklen > TC_COOKIE_MAX_SIZE) {
> - err = -EINVAL;
> tcf_hash_release(a, bind);
> - goto err_mod;
> + if (err != ACT_P_CREATED)
> + module_put(a_o->owner);
> + err = -EINVAL;
> + goto err_out;
> }
>
> if (nla_memdup_cookie(a, tb) < 0) {
> - err = -ENOMEM;
> tcf_hash_release(a, bind);
> - goto err_mod;
> + if (err != ACT_P_CREATED)
> + module_put(a_o->owner);
> + err = -ENOMEM;
> + goto err_out;
> }
> }
Powered by blists - more mailing lists