pkt_sched: Use rcu_assign_pointer() to change dev_queue->qdisc
authorJarek Poplawski <jarkao2@gmail.com>
Wed, 27 Aug 2008 09:22:07 +0000 (02:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 27 Aug 2008 09:22:07 +0000 (02:22 -0700)
These pointers are RCU protected, so proper primitives should be used.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c
net/sched/sch_generic.c

index 341d558b6e393ce5b9d64434cb81716365ad956b..ad9cda1b8c0a42d2c794e745e8013868b8485f22 100644 (file)
@@ -635,7 +635,7 @@ static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
        if (qdisc == NULL)
                qdisc = &noop_qdisc;
        dev_queue->qdisc_sleeping = qdisc;
-       dev_queue->qdisc = &noop_qdisc;
+       rcu_assign_pointer(dev_queue->qdisc, &noop_qdisc);
 
        spin_unlock_bh(root_lock);
 
index 5f0ade7806a733e732ebcc6756695c0065fd844d..9634091ee2f0f7f1c65059d6ae454281d2db0adf 100644 (file)
@@ -634,7 +634,7 @@ static void dev_deactivate_queue(struct net_device *dev,
                if (!(qdisc->flags & TCQ_F_BUILTIN))
                        set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state);
 
-               dev_queue->qdisc = qdisc_default;
+               rcu_assign_pointer(dev_queue->qdisc, qdisc_default);
                qdisc_reset(qdisc);
 
                spin_unlock_bh(qdisc_lock(qdisc));
@@ -709,7 +709,7 @@ static void shutdown_scheduler_queue(struct net_device *dev,
        struct Qdisc *qdisc_default = _qdisc_default;
 
        if (qdisc) {
-               dev_queue->qdisc = qdisc_default;
+               rcu_assign_pointer(dev_queue->qdisc, qdisc_default);
                dev_queue->qdisc_sleeping = qdisc_default;
 
                qdisc_destroy(qdisc);