[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <57079AEA.3010201@cogentembedded.com>
Date: Fri, 8 Apr 2016 14:50:02 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: roy.qing.li@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH] ipv6: rework the lock in addrconf_permanent_addr
Hello.
On 4/8/2016 12:22 PM, roy.qing.li@...il.com wrote:
> From: Li RongQing <roy.qing.li@...il.com>
>
> 1. nothing of idev is changed, so read lock is enough
> 2. ifp is changed, so used ifp->lock or cmpxchg to protect it
>
> Signed-off-by: Li RongQing <roy.qing.li@...il.com>
> ---
> net/ipv6/addrconf.c | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 27aed1a..f6e7605b 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
[...]
> @@ -3212,7 +3221,12 @@ static int fixup_permanent_addr(struct inet6_dev *idev,
> if (unlikely(IS_ERR(rt)))
> return PTR_ERR(rt);
>
> - ifp->rt = rt;
> + prev = cmpxchg(&ifp->rt, NULL, rt);
> +
> + /*if cmpxchg failed*/
Please add spaces after /* and before */
> + if (prev) {
> + ip6_rt_put(rt);
> + }
{} not needed here, please remove.
[...]
MBR, Sergei
Powered by blists - more mailing lists