Commit ba7863f4 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: snmp: fix 64bit stats on 32bit arches

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: 6aef70a8 ("net: snmp: kill various STATS_USER() helpers")
Reported-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8be2748a
...@@ -166,9 +166,9 @@ struct linux_xfrm_mib { ...@@ -166,9 +166,9 @@ struct linux_xfrm_mib {
#define SNMP_ADD_STATS64(mib, field, addend) \ #define SNMP_ADD_STATS64(mib, field, addend) \
do { \ do { \
preempt_disable(); \ local_bh_disable(); \
__SNMP_ADD_STATS64(mib, field, addend); \ __SNMP_ADD_STATS64(mib, field, addend); \
preempt_enable(); \ local_bh_enable(); \
} while (0) } while (0)
#define __SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) #define __SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
...@@ -184,9 +184,9 @@ struct linux_xfrm_mib { ...@@ -184,9 +184,9 @@ struct linux_xfrm_mib {
} while (0) } while (0)
#define SNMP_UPD_PO_STATS64(mib, basefield, addend) \ #define SNMP_UPD_PO_STATS64(mib, basefield, addend) \
do { \ do { \
preempt_disable(); \ local_bh_disable(); \
__SNMP_UPD_PO_STATS64(mib, basefield, addend); \ __SNMP_UPD_PO_STATS64(mib, basefield, addend); \
preempt_enable(); \ local_bh_enable(); \
} while (0) } while (0)
#else #else
#define __SNMP_INC_STATS64(mib, field) __SNMP_INC_STATS(mib, field) #define __SNMP_INC_STATS64(mib, field) __SNMP_INC_STATS(mib, field)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment