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: <369a64ff-2fe1-0700-00f1-85159ba08cf0@mojatatu.com>
Date:   Tue, 24 Jan 2017 06:09:23 -0500
From:   Jamal Hadi Salim <jhs@...atatu.com>
To:     Simon Horman <simon.horman@...ronome.com>
Cc:     davem@...emloft.net, netdev@...r.kernel.org, jiri@...lanox.com,
        paulb@...lanox.com, john.fastabend@...il.com, mrv@...atatu.com,
        hadarh@...lanox.com, ogerlitz@...lanox.com, roid@...lanox.com,
        xiyou.wangcong@...il.com, daniel@...earbox.net
Subject: Re: [PATCH net-next v6 1/1] net sched actions: Add support for user
 cookies

On 17-01-23 07:58 AM, Simon Horman wrote:
> Hi Jamal,
>
> On Sun, Jan 22, 2017 at 03:25:50PM -0500, Jamal Hadi Salim wrote:
>
> ...
>

>> @@ -33,6 +34,8 @@ static void free_tcf(struct rcu_head *head)
>>
>>  	free_percpu(p->cpu_bstats);
>>  	free_percpu(p->cpu_qstats);
>> +	kfree(p->act_cookie->data);
>
> Does the above need to be protected by a check for p->act_cookie being non-NULL?
>

Indeed it does.

>> +	kfree(p->act_cookie);
>>  	kfree(p);
>>  }
>>
>
> ...
>
>> @@ -575,6 +584,33 @@ struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
>>  	if (err < 0)
>>  		goto err_mod;
>>
>> +	if (tb[TCA_ACT_COOKIE]) {
>> +		int cklen = nla_len(tb[TCA_ACT_COOKIE]);
>> +
>> +		if (cklen > TC_COOKIE_MAX_SIZE) {
>> +			err = -EINVAL;
>> +			tcf_hash_release(a, bind);
>> +			goto err_mod;
>> +		}
>> +
>> +		a->act_cookie = kzalloc(sizeof(*a->act_cookie), GFP_KERNEL);
>> +		if (!a->act_cookie) {
>> +			err = -ENOMEM;
>> +			tcf_hash_release(a, bind);
>> +			goto err_mod;
>> +		}
>> +
>> +		a->act_cookie->data = nla_memdup(tb[TCA_ACT_COOKIE],
>> +						 GFP_KERNEL);
>> +		if (!a->act_cookie->data) {
>> +			err = -ENOMEM;
>> +			kfree(a->act_cookie);
>> +			tcf_hash_release(a, bind);
>> +			goto err_mod;
>> +		}
>> +		a->act_cookie->len = cklen;
>
> FWIW, the above looks correct but it also looks like the error handling
> could be done less verbosely if the logic was moved to a separate function.
>

I will make the change.

Thanks Simon.

cheers,
jamal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ