Skip to content

Commit

Permalink
net: snmp: fix 64bit stats on 32bit arches
Browse files Browse the repository at this point in the history
I accidentally replaced BH disabling by preemption disabling
in SNMP_ADD_STATS64() and SNMP_UPD_PO_STATS64() on 32bit builds.

For 64bit stats on 32bit arch, we really need to disable BH,
since the "struct u64_stats_sync syncp" might be manipulated
both from process and BH contexts.

Fixes: 6aef70a ("net: snmp: kill various STATS_USER() helpers")
Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 28, 2016
1 parent 8be2748 commit ba7863f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/net/snmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ struct linux_xfrm_mib {

#define SNMP_ADD_STATS64(mib, field, addend) \
do { \
preempt_disable(); \
local_bh_disable(); \
__SNMP_ADD_STATS64(mib, field, addend); \
preempt_enable(); \
local_bh_enable(); \
} while (0)

#define __SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
Expand All @@ -184,9 +184,9 @@ struct linux_xfrm_mib {
} while (0)
#define SNMP_UPD_PO_STATS64(mib, basefield, addend) \
do { \
preempt_disable(); \
local_bh_disable(); \
__SNMP_UPD_PO_STATS64(mib, basefield, addend); \
preempt_enable(); \
local_bh_enable(); \
} while (0)
#else
#define __SNMP_INC_STATS64(mib, field) __SNMP_INC_STATS(mib, field)
Expand Down

0 comments on commit ba7863f

Please sign in to comment.