From: David Ahern <dsahern@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
David Ahern <dsahern@kernel.org>,
davem@davemloft.net, jakub.kicinski@netronome.com
Cc: netdev@vger.kernel.org, rajendra.dendukuri@broadcom.com
Subject: Re: [PATCH net v2] ipv6: Handle race in addrconf_dad_work
Date: Wed, 2 Oct 2019 16:13:12 -0600 [thread overview]
Message-ID: <8d13d82c-6a91-1434-f1af-a2f39ecadbfb@gmail.com> (raw)
In-Reply-To: <146a2f8a-8ee9-65f3-1013-ef60a96aa27b@gmail.com>
On 10/2/19 3:23 PM, Eric Dumazet wrote:
>
>
> 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@gmail.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@google.com>
>>>
>>> Thanks !
>>>
>>
>> Apparently this patch causes problems. I yet have to make an analysis.
Ugh. I presume syzbot? can you forward the stack trace?
>
> 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;
> + }
That restores the original BUG() - ie., the reason for this patch.
The IF_READY flag needs to be checked before the call to addrconf_dad_begin.
> +
> spin_lock(&ifp->lock);
> if (ifp->state == INET6_IFADDR_STATE_DEAD) {
> spin_unlock(&ifp->lock);
>
next prev parent reply other threads:[~2019-10-02 22:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 3:28 [PATCH net v2] ipv6: Handle race in addrconf_dad_work David Ahern
2019-10-01 18:18 ` Eric Dumazet
2019-10-02 21:08 ` Eric Dumazet
2019-10-02 21:23 ` Eric Dumazet
2019-10-02 22:13 ` David Ahern [this message]
2019-10-02 22:21 ` Eric Dumazet
2019-10-02 22:33 ` David Ahern
2019-10-02 22:36 ` Eric Dumazet
2019-10-02 23:11 ` Eric Dumazet
2019-10-02 23:37 ` David Ahern
2019-10-03 0:10 ` David Ahern
2019-10-03 0:36 ` Eric Dumazet
2019-10-03 2:42 ` David Ahern
2019-10-03 15:50 ` David Ahern
2019-10-03 16:32 ` Eric Dumazet
2019-10-03 17:19 ` Eric Dumazet
2019-10-03 19:29 ` David Ahern
2019-10-02 1:45 ` David Miller
2019-10-06 11:46 ` [ipv6] 58a3c210a3: ltp.ping601.fail kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8d13d82c-6a91-1434-f1af-a2f39ecadbfb@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=eric.dumazet@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=netdev@vger.kernel.org \
--cc=rajendra.dendukuri@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).