]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
pkt_sched: cls_u32: Fix locking in u32_change()
authorJarek Poplawski <jarkao2@gmail.com>
Tue, 6 Jan 2009 02:14:19 +0000 (18:14 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 6 Jan 2009 02:14:19 +0000 (18:14 -0800)
New nodes are inserted in u32_change() under rtnl_lock() with wmb(),
so without tcf_tree_lock() like in other classifiers (e.g. cls_fw).
This isn't enough without rmb() on the read side, but on the other
hand adding such barriers doesn't give any savings, so the lock is
added instead.

Reported-by: m0sia <m0sia@plotinka.ru>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_u32.c

index 05d178008cbc9046d682f2bc2dbc01ce1e85737b..07372f60bee3364588cb94fcfcad1cc7bee514e5 100644 (file)
@@ -638,8 +638,9 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
                                break;
 
                n->next = *ins;
-               wmb();
+               tcf_tree_lock(tp);
                *ins = n;
+               tcf_tree_unlock(tp);
 
                *arg = (unsigned long)n;
                return 0;