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: <541A21F8.3000206@gmail.com>
Date:	Wed, 17 Sep 2014 17:06:16 -0700
From:	John Fastabend <john.fastabend@...il.com>
To:	Cong Wang <cwang@...pensource.com>
CC:	Cong Wang <xiyou.wangcong@...il.com>,
	David Miller <davem@...emloft.net>,
	Eric Dumazet <eric.dumazet@...il.com>,
	netdev <netdev@...r.kernel.org>,
	Jamal Hadi Salim <jhs@...atatu.com>
Subject: Re: [net-next PATCH 2/2] net: sched: cls_u32 changes to knode must
 appear atomic to readers

On 09/17/2014 02:11 PM, Cong Wang wrote:
> On Wed, Sep 17, 2014 at 12:12 PM, John Fastabend
> <john.fastabend@...il.com> wrote:
>>
>> -static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n)
>> +static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n, bool pf)
>>   {
>>          tcf_unbind_filter(tp, &n->res);
>>          tcf_exts_destroy(tp, &n->exts);
>>          if (n->ht_down)
>>                  n->ht_down->refcnt--;
>>   #ifdef CONFIG_CLS_U32_PERF
>> -       free_percpu(n->pf);
>> +       if (pf)
>
> Nit: 'free_pf' is a better name than just 'pf'.
>

agreed I'll update it.

>> +               free_percpu(n->pf);
>>   #endif
>>   #ifdef CONFIG_CLS_U32_MARK
>> -       free_percpu(n->pcpu_success);
>> +       if (pf)
>> +               free_percpu(n->pcpu_success);
>>   #endif
>>          kfree(n);
>>          return 0;
>>   }
>>
>> +static void u32_delete_key_rcu_pf(struct rcu_head *rcu)
>> +{
>> +       struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu);
>> +
>> +       u32_destroy_key(key->tp, key, false);
>> +}
>
> I think you need a comment here to explain why you free it partially
> on purpose, it is not that clear, at least I spent some time to figure
> it out when I read your cls_tcindex patch.
>
> Thanks!
>

Sure how about this,

/* u32_delete_key_rcu_pf should be called when free'ing a copied
  * version of a tc_u_knode obtained from u32_init_knode(). When
  * copies are obtained from u32_init_knode() the statistics are
  * shared between the old and new copies to allow readers to
  * continue to update the statistics during the copy. To support
  * this the u32_delete_key_rcu_pf variant does not free the percpu
  * statistics.
  */


-- 
John Fastabend         Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ