Subject: Re: [PATCH 2/9] PKT_SCHED: tc filter extension API

From: Patrick McHardy <[email-masked]>
Date: Fri, 31 Dec 2004 15:18:49 +0100

Thomas Graf wrote:
> * jamal <[email-masked]> 2004-12-30 23:36
> 
> 
>>Patrick pointed this in other email: the xchg is sort of defeated by the
>>else. Perhaps make  the second one xchg as well.
> 
> Agreed, I changed it to:
> 
> 		struct tc_action *act;
> 		act = xchg(&dst->action, src->action);
> 		if (act)
> 			tcf_action_destroy(act, TCA_ACT_UNBIND);
> 
> Am I missing something?

Yes, the xchg without locking is only right in case we don't have
an existing action that needs to be destroyed. Someone might still
be looking at the old action in a softirq. If you want to keep the
"lockless" variant, you need to call synchronize_net() before
tcf_action_destroy().

Regards
Patrick