From: Roman Mashak <mrv@mojatatu.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Jamal Hadi Salim <jhs@mojatatu.com>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH linux 2/2] net sched actions: fix refcount decrement on error
Date: Thu, 13 Apr 2017 09:39:43 -0400 [thread overview]
Message-ID: <85inm8pgtc.fsf@mojatatu.com> (raw)
In-Reply-To: <20170412142140.26649-3-w.bumiller@proxmox.com> (Wolfgang Bumiller's message of "Wed, 12 Apr 2017 16:21:40 +0200")
Wolfgang Bumiller <w.bumiller@proxmox.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;
> }
> }
next prev parent reply other threads:[~2017-04-13 13:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-12 14:21 [RFC PATCH linux 0/2] net sched actions: access to uninitialized data and error handling Wolfgang Bumiller
2017-04-12 14:21 ` [PATCH linux 1/2] net sched actions: fix access to uninitialized data Wolfgang Bumiller
2017-04-12 14:21 ` [PATCH linux 2/2] net sched actions: fix refcount decrement on error Wolfgang Bumiller
2017-04-13 4:27 ` Cong Wang
2017-04-13 8:06 ` Wolfgang Bumiller
2017-04-13 18:03 ` Cong Wang
2017-04-14 9:08 ` Wolfgang Bumiller
2017-04-15 18:20 ` Cong Wang
2017-04-15 18:48 ` Wolfgang Bumiller
2017-04-17 18:10 ` Cong Wang
2017-04-13 13:39 ` Roman Mashak [this message]
2017-04-13 1:22 ` [RFC PATCH linux 0/2] net sched actions: access to uninitialized data and error handling Cong Wang
2017-04-17 14:59 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85inm8pgtc.fsf@mojatatu.com \
--to=mrv@mojatatu.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=w.bumiller@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).