mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Duoming Zhou <duoming@zju.edu.cn>, linux-kernel@vger.kernel.org
Cc: davem@davemloft.net, yoshfuji@linux-ipv6.org,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH net] net: Add a gfp_t parameter in ip_fib_metrics_init to support atomic context
Date: Tue, 29 Nov 2022 09:33:45 -0700	[thread overview]
Message-ID: <a37f9c82-9f25-c5ba-f941-1cedf8c10187@kernel.org> (raw)
In-Reply-To: <20221129055317.53788-1-duoming@zju.edu.cn>

On 11/28/22 10:53 PM, Duoming Zhou wrote:
> The ip_fib_metrics_init() do not support atomic context, because it
> calls "kzalloc(..., GFP_KERNEL)". When ip_fib_metrics_init() is used
> in atomic context, the sleep-in-atomic-context bug will happen.

Did you actually hit this sleep-in-atomic-context bug or is it theory
based on code analysis?

> 
> For example, the neigh_proxy_process() is a timer handler that is
> used to process the proxy request that is timeout. But it could call
> ip_fib_metrics_init(). As a result, the can_block flag in ipv6_add_addr()
> and the gfp_flags in addrconf_f6i_alloc() and ip6_route_info_create()
> are useless. The process is shown below.
> 
>     (atomic context)
> neigh_proxy_process()
>   pndisc_redo()
>     ndisc_recv_ns()
>       addrconf_dad_failure()
>         ipv6_add_addr(..., bool can_block)
>           addrconf_f6i_alloc(..., gfp_t gfp_flags)

	cfg has fc_mx == NULL.

>             ip6_route_info_create(..., gfp_t gfp_flags)

	rt->fib6_metrics = ip_fib_metrics_init(net, cfg->fc_mx, cfg->fc_mx_len,
extack);

>               ip_fib_metrics_init()

        if (!fc_mx)
                return (struct dst_metrics *)&dst_default_metrics;


>                 kzalloc(..., GFP_KERNEL) //may sleep
> 


  reply	other threads:[~2022-11-29 16:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29  5:53 Duoming Zhou
2022-11-29 16:33 ` David Ahern [this message]
2022-11-30  4:01   ` duoming

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=a37f9c82-9f25-c5ba-f941-1cedf8c10187@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=duoming@zju.edu.cn \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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

all inboxes | Powered by JetHome®