summaryrefslogtreecommitdiff
path: root/include/linux/padata.h
diff options
context:
space:
mode:
authorXiyu Yang <xiyuyang19@fudan.edu.cn>2021-07-20 11:05:11 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2021-07-30 10:58:36 +0800
commitd5ee8e750c9449e9849a09ce6fb6b8adeaa66adc (patch)
tree6df905f46fef4e34073c1dc2c6ac9407de3ded3a /include/linux/padata.h
parent192b722f3866d3fb45b9e6a6ecd02ff09f2aefbe (diff)
padata: Convert from atomic_t to refcount_t on parallel_data->refcnt
refcount_t type and corresponding API can protect refcounters from accidental underflow and overflow and further use-after-free situations. Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn> Signed-off-by: Xin Tan <tanxin.ctf@gmail.com> Acked-by: Daniel Jordan <daniel.m.jordan@oracle.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/linux/padata.h')
-rw-r--r--include/linux/padata.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/padata.h b/include/linux/padata.h
index a433f13fc4bf..495b16b6b4d7 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -12,6 +12,7 @@
#ifndef PADATA_H
#define PADATA_H
+#include <linux/refcount.h>
#include <linux/compiler_types.h>
#include <linux/workqueue.h>
#include <linux/spinlock.h>
@@ -96,7 +97,7 @@ struct parallel_data {
struct padata_shell *ps;
struct padata_list __percpu *reorder_list;
struct padata_serial_queue __percpu *squeue;
- atomic_t refcnt;
+ refcount_t refcnt;
unsigned int seq_nr;
unsigned int processed;
int cpu;