[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpWbxs6aa-axQrwN5pipaCDX3ws_08LaQON8p4WfrJ7SDg@mail.gmail.com>
Date: Fri, 18 Aug 2017 10:15:08 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 net-next] ipv4: convert dst_metrics.refcnt from
atomic_t to refcount_t
On Wed, Aug 16, 2017 at 4:19 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> 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@...gle.com>
> ---
> v2: fix a missing change in net/ipv4/fib_semantics.c
>
> include/net/dst.h | 2 +-
> net/core/dst.c | 6 +++---
> net/ipv4/fib_semantics.c | 4 ++--
> net/ipv4/route.c | 4 ++--
> 4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/include/net/dst.h b/include/net/dst.h
> index f73611ec401754d4f52b5310a24da53566dafce6..dd38177c3a61f5c4e48be9d57d4d10d6b7d14672 100644
> --- a/include/net/dst.h
> +++ b/include/net/dst.h
> @@ -107,7 +107,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;
#include linux/refcount.h explicitly?
Powered by blists - more mailing lists