@@ -646,7 +646,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
646
646
647
647
sch_tree_lock (sch );
648
648
649
- q -> nbands = nbands ;
649
+ WRITE_ONCE ( q -> nbands , nbands ) ;
650
650
for (i = nstrict ; i < q -> nstrict ; i ++ ) {
651
651
if (q -> classes [i ].qdisc -> q .qlen ) {
652
652
list_add_tail (& q -> classes [i ].alist , & q -> active );
@@ -658,11 +658,11 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
658
658
list_del (& q -> classes [i ].alist );
659
659
qdisc_tree_flush_backlog (q -> classes [i ].qdisc );
660
660
}
661
- q -> nstrict = nstrict ;
661
+ WRITE_ONCE ( q -> nstrict , nstrict ) ;
662
662
memcpy (q -> prio2band , priomap , sizeof (priomap ));
663
663
664
664
for (i = 0 ; i < q -> nbands ; i ++ )
665
- q -> classes [i ].quantum = quanta [i ];
665
+ WRITE_ONCE ( q -> classes [i ].quantum , quanta [i ]) ;
666
666
667
667
for (i = oldbands ; i < q -> nbands ; i ++ ) {
668
668
q -> classes [i ].qdisc = queues [i ];
@@ -676,7 +676,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
676
676
for (i = q -> nbands ; i < oldbands ; i ++ ) {
677
677
qdisc_put (q -> classes [i ].qdisc );
678
678
q -> classes [i ].qdisc = NULL ;
679
- q -> classes [i ].quantum = 0 ;
679
+ WRITE_ONCE ( q -> classes [i ].quantum , 0 ) ;
680
680
q -> classes [i ].deficit = 0 ;
681
681
gnet_stats_basic_sync_init (& q -> classes [i ].bstats );
682
682
memset (& q -> classes [i ].qstats , 0 , sizeof (q -> classes [i ].qstats ));
@@ -733,6 +733,7 @@ static int ets_qdisc_dump(struct Qdisc *sch, struct sk_buff *skb)
733
733
struct ets_sched * q = qdisc_priv (sch );
734
734
struct nlattr * opts ;
735
735
struct nlattr * nest ;
736
+ u8 nbands , nstrict ;
736
737
int band ;
737
738
int prio ;
738
739
int err ;
@@ -745,21 +746,22 @@ static int ets_qdisc_dump(struct Qdisc *sch, struct sk_buff *skb)
745
746
if (!opts )
746
747
goto nla_err ;
747
748
748
- if (nla_put_u8 (skb , TCA_ETS_NBANDS , q -> nbands ))
749
+ nbands = READ_ONCE (q -> nbands );
750
+ if (nla_put_u8 (skb , TCA_ETS_NBANDS , nbands ))
749
751
goto nla_err ;
750
752
751
- if (q -> nstrict &&
752
- nla_put_u8 (skb , TCA_ETS_NSTRICT , q -> nstrict ))
753
+ nstrict = READ_ONCE (q -> nstrict );
754
+ if ( nstrict && nla_put_u8 (skb , TCA_ETS_NSTRICT , nstrict ))
753
755
goto nla_err ;
754
756
755
- if (q -> nbands > q -> nstrict ) {
757
+ if (nbands > nstrict ) {
756
758
nest = nla_nest_start (skb , TCA_ETS_QUANTA );
757
759
if (!nest )
758
760
goto nla_err ;
759
761
760
- for (band = q -> nstrict ; band < q -> nbands ; band ++ ) {
762
+ for (band = nstrict ; band < nbands ; band ++ ) {
761
763
if (nla_put_u32 (skb , TCA_ETS_QUANTA_BAND ,
762
- q -> classes [band ].quantum ))
764
+ READ_ONCE ( q -> classes [band ].quantum ) ))
763
765
goto nla_err ;
764
766
}
765
767
@@ -771,7 +773,8 @@ static int ets_qdisc_dump(struct Qdisc *sch, struct sk_buff *skb)
771
773
goto nla_err ;
772
774
773
775
for (prio = 0 ; prio <= TC_PRIO_MAX ; prio ++ ) {
774
- if (nla_put_u8 (skb , TCA_ETS_PRIOMAP_BAND , q -> prio2band [prio ]))
776
+ if (nla_put_u8 (skb , TCA_ETS_PRIOMAP_BAND ,
777
+ READ_ONCE (q -> prio2band [prio ])))
775
778
goto nla_err ;
776
779
}
777
780
0 commit comments