Subject: Re: [PATCH net-next] net/sched: cls_flower: verify root pointer before dereferncing it

From: Jiri Pirko <[email-masked]>
Date: Tue, 22 Nov 2016 17:13:07 +0100

Tue, Nov 22, 2016 at 04:37:42PM CET, [email-masked] wrote:
>From: Jiri Pirko <[email-masked]>
>Date: Tue, 22 Nov 2016 15:48:44 +0100
>
>> Tue, Nov 22, 2016 at 03:25:26PM CET, [email-masked] wrote:
>>>tp->root is being allocated in init() time and kfreed in destroy()
>>>however it is being dereferenced in classify() path.
>>>
>>>We could be in classify() path after destroy() was called and thus 
>>>tp->root is null. Verifying if tp->root is null in classify() path 
>>>is enough because it's being freed with kfree_rcu() and classify() 
>>>path is under rcu_read_lock().
>>>
>>>Fixes: 1e052be69d04 ("net_sched: destroy proto tp when all filters are gone")
>>>Signed-off-by: Roi Dayan <[email-masked]>
>>>Cc: Cong Wang <[email-masked]>
>> 
>> This is correct
>> 
>> Reviewed-by: Jiri Pirko <[email-masked]>
>> 
>> The other way to fix this would be to move tp->ops->destroy call to
>> call_rcu phase. That would require bigger changes though. net-next
>> perhaps?
>
>This patch is targetted at net-next as per Subj.

Oh, right, then it should be fixed so the tp->head could be never null