Commit fa52f15
net: cadence: macb: Synchronize stats calculations
Stats calculations involve a RMW to add the stat update to the existing
value. This is currently not protected by any synchronization mechanism,
so data races are possible. Add a spinlock to protect the update. The
reader side could be protected using u64_stats, but we would still need
a spinlock for the update side anyway. And we always do an update
immediately before reading the stats anyway.
Fixes: 89e5785 ("[PATCH] Atmel MACB ethernet driver")
Signed-off-by: Sean Anderson <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>1 parent 27843ce commit fa52f15
2 files changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1279 | 1279 | | |
1280 | 1280 | | |
1281 | 1281 | | |
| 1282 | + | |
| 1283 | + | |
1282 | 1284 | | |
1283 | 1285 | | |
1284 | 1286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1978 | 1978 | | |
1979 | 1979 | | |
1980 | 1980 | | |
| 1981 | + | |
1981 | 1982 | | |
1982 | 1983 | | |
1983 | 1984 | | |
1984 | 1985 | | |
| 1986 | + | |
1985 | 1987 | | |
1986 | 1988 | | |
1987 | 1989 | | |
| |||
3102 | 3104 | | |
3103 | 3105 | | |
3104 | 3106 | | |
| 3107 | + | |
3105 | 3108 | | |
3106 | 3109 | | |
3107 | 3110 | | |
| |||
3131 | 3134 | | |
3132 | 3135 | | |
3133 | 3136 | | |
| 3137 | + | |
3134 | 3138 | | |
3135 | 3139 | | |
3136 | 3140 | | |
3137 | 3141 | | |
3138 | 3142 | | |
3139 | 3143 | | |
3140 | 3144 | | |
3141 | | - | |
| 3145 | + | |
3142 | 3146 | | |
3143 | | - | |
| 3147 | + | |
3144 | 3148 | | |
3145 | 3149 | | |
3146 | 3150 | | |
| 3151 | + | |
3147 | 3152 | | |
3148 | 3153 | | |
3149 | 3154 | | |
| |||
3193 | 3198 | | |
3194 | 3199 | | |
3195 | 3200 | | |
| 3201 | + | |
3196 | 3202 | | |
3197 | 3203 | | |
3198 | 3204 | | |
| |||
3226 | 3232 | | |
3227 | 3233 | | |
3228 | 3234 | | |
| 3235 | + | |
3229 | 3236 | | |
3230 | 3237 | | |
3231 | 3238 | | |
| |||
5097 | 5104 | | |
5098 | 5105 | | |
5099 | 5106 | | |
| 5107 | + | |
5100 | 5108 | | |
5101 | 5109 | | |
5102 | 5110 | | |
| |||
0 commit comments