]>
Commit | Line | Data |
---|---|---|
29e62dc0 FG |
1 | From b3c6f3b25edface1ece9b30aa1fe5d6f9abae098 Mon Sep 17 00:00:00 2001 |
2 | From: Wolfgang Bumiller <w.bumiller@proxmox.com> | |
3 | Date: Thu, 13 Apr 2017 10:13:32 +0200 | |
4 | Subject: [Zesty][PATCH 2/2] UBUNTU: SAUCE: net sched actions: decrement module refcount earlier | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1682368 | |
10 | ||
11 | Whether the reference count has to be decremented depends | |
12 | on whether the policy was created. If TCA_ACT_COOKIE is | |
13 | passed and an error occurs there, the same condition still | |
14 | has to be honored. | |
15 | ||
16 | Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> | |
17 | (cherry-picked from http://marc.info/?l=linux-netdev&m=149200742616349) | |
18 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
19 | --- | |
20 | net/sched/act_api.c | 17 +++++++++-------- | |
21 | 1 file changed, 9 insertions(+), 8 deletions(-) | |
22 | ||
23 | diff --git a/net/sched/act_api.c b/net/sched/act_api.c | |
24 | index 32f12f5..07068ca 100644 | |
25 | --- a/net/sched/act_api.c | |
26 | +++ b/net/sched/act_api.c | |
27 | @@ -607,28 +607,29 @@ struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla, | |
28 | if (err < 0) | |
29 | goto err_mod; | |
30 | ||
31 | + /* module count goes up only when brand new policy is created | |
32 | + * if it exists and is only bound to in a_o->init() then | |
33 | + * ACT_P_CREATED is not returned (a zero is). | |
34 | + */ | |
35 | + if (err != ACT_P_CREATED) | |
36 | + module_put(a_o->owner); | |
37 | + | |
38 | if (name == NULL && tb[TCA_ACT_COOKIE]) { | |
39 | int cklen = nla_len(tb[TCA_ACT_COOKIE]); | |
40 | ||
41 | if (cklen > TC_COOKIE_MAX_SIZE) { | |
42 | err = -EINVAL; | |
43 | tcf_hash_release(a, bind); | |
44 | - goto err_mod; | |
45 | + goto err_out; | |
46 | } | |
47 | ||
48 | if (nla_memdup_cookie(a, tb) < 0) { | |
49 | err = -ENOMEM; | |
50 | tcf_hash_release(a, bind); | |
51 | - goto err_mod; | |
52 | + goto err_out; | |
53 | } | |
54 | } | |
55 | ||
56 | - /* module count goes up only when brand new policy is created | |
57 | - * if it exists and is only bound to in a_o->init() then | |
58 | - * ACT_P_CREATED is not returned (a zero is). | |
59 | - */ | |
60 | - if (err != ACT_P_CREATED) | |
61 | - module_put(a_o->owner); | |
62 | ||
63 | return a; | |
64 | ||
65 | -- | |
66 | 2.1.4 | |
67 |