lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpVucDgy-=ToNrH1a9h1h7goK33hfY_o30e5Rz1Pqwj4_A@mail.gmail.com>
Date:   Tue, 18 Apr 2017 23:23:30 -0700
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     Jamal Hadi Salim <jhs@...atatu.com>
Cc:     Wolfgang Bumiller <w.bumiller@...xmox.com>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH v2 net 2/2] net sched actions: decrement module refcount earlier

On Tue, Apr 18, 2017 at 7:21 PM, Jamal Hadi Salim <jhs@...atatu.com> wrote:
> Indeed. Allocate the cookie before init? That way, we fail early
> and dont need to worry about restoring anything.

No, a->act_cookie needs an action pointer first. ;)

> In the case of a replace, do you really want to call tcf_hash_release?
>

Good point. Probably no, we already call it inside ->init().

Something like this...

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 82b1d48d91cc..29ffc348fe2f 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -609,14 +609,12 @@ struct tc_action *tcf_action_init_1(struct net
*net, struct nlattr *nla,

                if (cklen > TC_COOKIE_MAX_SIZE) {
                        err = -EINVAL;
-                       tcf_hash_release(a, bind);
-                       goto err_mod;
+                       goto err_release;
                }

                if (nla_memdup_cookie(a, tb) < 0) {
                        err = -ENOMEM;
-                       tcf_hash_release(a, bind);
-                       goto err_mod;
+                       goto err_release;
                }
        }

@@ -629,6 +627,9 @@ struct tc_action *tcf_action_init_1(struct net
*net, struct nlattr *nla,

        return a;

+err_release:
+       if (err == ACT_P_CREATED)
+               tcf_hash_release(a, bind);
 err_mod:
        module_put(a_o->owner);
 err_out:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ