summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYajun Deng <yajun.deng@linux.dev>2021-07-29 15:13:50 +0800
committerJakub Kicinski <kuba@kernel.org>2021-07-30 15:33:24 +0200
commit79976892f7ea37f44f8bcfb6d266954e8ae0124d (patch)
tree9e438088b39b37c3f5cb1152cb59d284f9adaf8a /include
parent3e12361b6d23f793580a50a6008633501c56ea1d (diff)
net: convert fib_treeref from int to refcount_t
refcount_t type should be used instead of int when fib_treeref is used as a reference counter,and avoid use-after-free risks. Signed-off-by: Yajun Deng <yajun.deng@linux.dev> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20210729071350.28919-1-yajun.deng@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/dn_fib.h2
-rw-r--r--include/net/ip_fib.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index ccc6e9df178b..ddd6565957b3 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -29,7 +29,7 @@ struct dn_fib_nh {
struct dn_fib_info {
struct dn_fib_info *fib_next;
struct dn_fib_info *fib_prev;
- int fib_treeref;
+ refcount_t fib_treeref;
refcount_t fib_clntref;
int fib_dead;
unsigned int fib_flags;
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 3ab2563b1a23..21c5386d4a6d 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -133,7 +133,7 @@ struct fib_info {
struct hlist_node fib_lhash;
struct list_head nh_list;
struct net *fib_net;
- int fib_treeref;
+ refcount_t fib_treeref;
refcount_t fib_clntref;
unsigned int fib_flags;
unsigned char fib_dead;