Hello.

On 4/8/2016 12:22 PM, roy.qing...@gmail.com wrote:

From: Li RongQing <roy.qing...@gmail.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...@gmail.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

Reply via email to