netdev
[Top] [All Lists]

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

To: Patrick McHardy <kaber@xxxxxxxxx>
Subject: Re: [PATCH 2/9] PKT_SCHED: tc filter extension API
From: Thomas Graf <tgraf@xxxxxxx>
Date: Fri, 31 Dec 2004 15:35:22 +0100
Cc: jamal <hadi@xxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <41D55FC9.6040605@xxxxxxxxx>
References: <20041230122652.GM32419@xxxxxxxxxxxxxx> <20041230123023.GO32419@xxxxxxxxxxxxxx> <1104467816.1049.181.camel@xxxxxxxxxxxxxxxx> <20041231131039.GI32419@xxxxxxxxxxxxxx> <41D55FC9.6040605@xxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
* Patrick McHardy <41D55FC9.6040605@xxxxxxxxx> 2004-12-31 15:18
> Thomas Graf wrote:
> >             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().

You're absolutely right. I will put locks around it again to avoid
having the pointer exchanged in the middle of a classification.
A synchronize_net will avoid the crash but will no prevent a
possible corruption of the classification result if the action is used
more than once.

<Prev in Thread] Current Thread [Next in Thread>