summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/amd_nb.h
diff options
context:
space:
mode:
authorElena Reshetova <elena.reshetova@intel.com>2017-05-19 12:39:13 +0300
committerThomas Gleixner <tglx@linutronix.de>2017-05-21 22:55:13 +0300
commit473e90b2e8356f084dcf9c815a5170d4d4925897 (patch)
tree59e060264aa0a1d6c3cc32a04dba8170bdceca56 /arch/x86/include/asm/amd_nb.h
parent5f0744e50db1628d6de770b92278445b3de2779f (diff)
downloadlinux-473e90b2e8356f084dcf9c815a5170d4d4925897.tar.xz
x86/mce: Convert threshold_bank.cpus from atomic_t to refcount_t
The refcount_t type and corresponding API should be used instead of atomic_t when the variable is used as a reference counter. This allows to avoid accidental refcounter overflows that might lead to use-after-free situations. Suggested-by: Kees Cook <keescook@chromium.org> Signed-off-by: Elena Reshetova <elena.reshetova@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Hans Liljestrand <ishkamiel@gmail.com> Reviewed-by: David Windsor <dwindsor@gmail.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Yazen Ghannam <Yazen.Ghannam@amd.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/1492695536-5947-1-git-send-email-elena.reshetova@intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/include/asm/amd_nb.h')
-rw-r--r--arch/x86/include/asm/amd_nb.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h
index 00c88a01301d..da181ad1d5f8 100644
--- a/arch/x86/include/asm/amd_nb.h
+++ b/arch/x86/include/asm/amd_nb.h
@@ -3,6 +3,7 @@
#include <linux/ioport.h>
#include <linux/pci.h>
+#include <linux/refcount.h>
struct amd_nb_bus_dev_range {
u8 bus;
@@ -55,7 +56,7 @@ struct threshold_bank {
struct threshold_block *blocks;
/* initialized to the number of CPUs on the node sharing this bank */
- atomic_t cpus;
+ refcount_t cpus;
};
struct amd_northbridge {