[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <146a2f8a-8ee9-65f3-1013-ef60a96aa27b@gmail.com>
Date: Wed, 2 Oct 2019 14:23:04 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Ahern <dsahern@...nel.org>, davem@...emloft.net,
jakub.kicinski@...ronome.com
Cc: netdev@...r.kernel.org, rajendra.dendukuri@...adcom.com,
David Ahern <dsahern@...il.com>
Subject: Re: [PATCH net v2] ipv6: Handle race in addrconf_dad_work
On 10/2/19 2:08 PM, Eric Dumazet wrote:
>
>
> On 10/1/19 11:18 AM, Eric Dumazet wrote:
>>
>>
>> On 9/30/19 8:28 PM, David Ahern wrote:
>>> From: David Ahern <dsahern@...il.com>
>>>
>>> Rajendra reported a kernel panic when a link was taken down:
>>>
>>> [ 6870.263084] BUG: unable to handle kernel NULL pointer dereference at 00000000000000a8
>>> [ 6870.271856] IP: [<ffffffff8efc5764>] __ipv6_ifa_notify+0x154/0x290
>>>
>>> <snip>
>>>
>>
>> Reviewed-by: Eric Dumazet <edumazet@...gle.com>
>>
>> Thanks !
>>
>
> Apparently this patch causes problems. I yet have to make an analysis.
>
It seems we need to allow the code to do some changes if IF_READY is not set.
WDYT ?
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index dd3be06d5a066e494617d4917c757eae19340d4d..e8181a3700213b9574ea25130689c9218236245d 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4035,7 +4035,7 @@ static void addrconf_dad_work(struct work_struct *w)
/* check if device was taken down before this delayed work
* function could be canceled
*/
- if (idev->dead || !(idev->if_flags & IF_READY))
+ if (idev->dead)
goto out;
spin_lock_bh(&ifp->lock);
@@ -4083,6 +4083,11 @@ static void addrconf_dad_work(struct work_struct *w)
goto out;
write_lock_bh(&idev->lock);
+ if (!(idev->if_flags & IF_READY)) {
+ write_unlock_bh(&idev->lock);
+ goto out;
+ }
+
spin_lock(&ifp->lock);
if (ifp->state == INET6_IFADDR_STATE_DEAD) {
spin_unlock(&ifp->lock);
Powered by blists - more mailing lists