@@ -658,7 +658,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
658
658
659
659
sch_tree_lock (sch );
660
660
661
- q -> nbands = nbands ;
661
+ WRITE_ONCE ( q -> nbands , nbands ) ;
662
662
for (i = nstrict ; i < q -> nstrict ; i ++ ) {
663
663
if (q -> classes [i ].qdisc -> q .qlen ) {
664
664
list_add_tail (& q -> classes [i ].alist , & q -> active );
@@ -670,11 +670,11 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
670
670
list_del_init (& q -> classes [i ].alist );
671
671
qdisc_purge_queue (q -> classes [i ].qdisc );
672
672
}
673
- q -> nstrict = nstrict ;
673
+ WRITE_ONCE ( q -> nstrict , nstrict ) ;
674
674
memcpy (q -> prio2band , priomap , sizeof (priomap ));
675
675
676
676
for (i = 0 ; i < q -> nbands ; i ++ )
677
- q -> classes [i ].quantum = quanta [i ];
677
+ WRITE_ONCE ( q -> classes [i ].quantum , quanta [i ]) ;
678
678
679
679
for (i = oldbands ; i < q -> nbands ; i ++ ) {
680
680
q -> classes [i ].qdisc = queues [i ];
@@ -688,7 +688,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
688
688
for (i = q -> nbands ; i < oldbands ; i ++ ) {
689
689
qdisc_put (q -> classes [i ].qdisc );
690
690
q -> classes [i ].qdisc = NULL ;
691
- q -> classes [i ].quantum = 0 ;
691
+ WRITE_ONCE ( q -> classes [i ].quantum , 0 ) ;
692
692
q -> classes [i ].deficit = 0 ;
693
693
gnet_stats_basic_sync_init (& q -> classes [i ].bstats );
694
694
memset (& q -> classes [i ].qstats , 0 , sizeof (q -> classes [i ].qstats ));
@@ -747,6 +747,7 @@ static int ets_qdisc_dump(struct Qdisc *sch, struct sk_buff *skb)
747
747
struct ets_sched * q = qdisc_priv (sch );
748
748
struct nlattr * opts ;
749
749
struct nlattr * nest ;
750
+ u8 nbands , nstrict ;
750
751
int band ;
751
752
int prio ;
752
753
int err ;
@@ -759,21 +760,22 @@ static int ets_qdisc_dump(struct Qdisc *sch, struct sk_buff *skb)
759
760
if (!opts )
760
761
goto nla_err ;
761
762
762
- if (nla_put_u8 (skb , TCA_ETS_NBANDS , q -> nbands ))
763
+ nbands = READ_ONCE (q -> nbands );
764
+ if (nla_put_u8 (skb , TCA_ETS_NBANDS , nbands ))
763
765
goto nla_err ;
764
766
765
- if (q -> nstrict &&
766
- nla_put_u8 (skb , TCA_ETS_NSTRICT , q -> nstrict ))
767
+ nstrict = READ_ONCE (q -> nstrict );
768
+ if ( nstrict && nla_put_u8 (skb , TCA_ETS_NSTRICT , nstrict ))
767
769
goto nla_err ;
768
770
769
- if (q -> nbands > q -> nstrict ) {
771
+ if (nbands > nstrict ) {
770
772
nest = nla_nest_start (skb , TCA_ETS_QUANTA );
771
773
if (!nest )
772
774
goto nla_err ;
773
775
774
- for (band = q -> nstrict ; band < q -> nbands ; band ++ ) {
776
+ for (band = nstrict ; band < nbands ; band ++ ) {
775
777
if (nla_put_u32 (skb , TCA_ETS_QUANTA_BAND ,
776
- q -> classes [band ].quantum ))
778
+ READ_ONCE ( q -> classes [band ].quantum ) ))
777
779
goto nla_err ;
778
780
}
779
781
@@ -785,7 +787,8 @@ static int ets_qdisc_dump(struct Qdisc *sch, struct sk_buff *skb)
785
787
goto nla_err ;
786
788
787
789
for (prio = 0 ; prio <= TC_PRIO_MAX ; prio ++ ) {
788
- if (nla_put_u8 (skb , TCA_ETS_PRIOMAP_BAND , q -> prio2band [prio ]))
790
+ if (nla_put_u8 (skb , TCA_ETS_PRIOMAP_BAND ,
791
+ READ_ONCE (q -> prio2band [prio ])))
789
792
goto nla_err ;
790
793
}
791
794
0 commit comments