diff options
author | Eric Dumazet <edumazet@google.com> | 2017-08-18 12:08:07 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-18 15:14:07 -0700 |
commit | 9620fef27ed2cdb37bf6fd028f32bea2ef5119a8 (patch) | |
tree | 7d4b243d0f353b98fd379d0d6ad800d734506e30 /include/net/dst.h | |
parent | 633cefe390e59e9449dc88707235e57ac76b5c38 (diff) |
ipv4: convert dst_metrics.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: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dst.h')
-rw-r--r-- | include/net/dst.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index f73611ec4017..93568bd0a352 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -14,6 +14,7 @@ #include <linux/rcupdate.h> #include <linux/bug.h> #include <linux/jiffies.h> +#include <linux/refcount.h> #include <net/neighbour.h> #include <asm/processor.h> @@ -107,7 +108,7 @@ struct dst_entry { struct dst_metrics { u32 metrics[RTAX_MAX]; - atomic_t refcnt; + refcount_t refcnt; }; extern const struct dst_metrics dst_default_metrics; |