Received: with ECARTIS (v1.0.0; list netdev); Fri, 31 Dec 2004 06:26:54 -0800 (PST) Received: from b.mx.projectdream.org (eth0-0.arisu.projectdream.org [194.158.4.191]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iBVEQQEx028189 for ; Fri, 31 Dec 2004 06:26:47 -0800 Received: from postel.suug.ch (unknown [195.134.158.23]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by b.mx.projectdream.org (Postfix) with ESMTP id 6D303F; Fri, 31 Dec 2004 15:34:39 +0100 (CET) Received: by postel.suug.ch (Postfix, from userid 10001) id D2BC61C0EA; Fri, 31 Dec 2004 15:35:22 +0100 (CET) Date: Fri, 31 Dec 2004 15:35:22 +0100 From: Thomas Graf To: Patrick McHardy Cc: jamal , "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH 2/9] PKT_SCHED: tc filter extension API Message-ID: <20041231143522.GM32419@postel.suug.ch> References: <20041230122652.GM32419@postel.suug.ch> <20041230123023.GO32419@postel.suug.ch> <1104467816.1049.181.camel@jzny.localdomain> <20041231131039.GI32419@postel.suug.ch> <41D55FC9.6040605@trash.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41D55FC9.6040605@trash.net> X-Virus-Scanned: ClamAV 0.80/645/Mon Dec 27 14:56:20 2004 clamav-milter version 0.80j on 127.0.0.1 X-Virus-Status: Clean X-archive-position: 13295 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: tgraf@suug.ch Precedence: bulk X-list: netdev * Patrick McHardy <41D55FC9.6040605@trash.net> 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.