summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorReshetova, Elena <elena.reshetova@intel.com>2017-03-21 13:59:19 +0200
committerDavid S. Miller <davem@davemloft.net>2017-03-22 12:06:08 -0700
commit4c355cdfbba537971b5c3849680b1b6453a7a383 (patch)
tree0992566cf726ff06986c271a2f7aff0c911d9441 /include
parent726bceca81ba09956226ea03c9fb58e037c3db7d (diff)
net: convert sk_filter.refcnt from atomic_t to refcount_t
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. Signed-off-by: Elena Reshetova <elena.reshetova@intel.com> Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David Windsor <dwindsor@gmail.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/filter.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h
index dffa072b7b79..511fe910bf1d 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -7,6 +7,7 @@
#include <stdarg.h>
#include <linux/atomic.h>
+#include <linux/refcount.h>
#include <linux/compat.h>
#include <linux/skbuff.h>
#include <linux/linkage.h>
@@ -430,7 +431,7 @@ struct bpf_prog {
};
struct sk_filter {
- atomic_t refcnt;
+ refcount_t refcnt;
struct rcu_head rcu;
struct bpf_prog *prog;
};