[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a37f9c82-9f25-c5ba-f941-1cedf8c10187@kernel.org>
Date: Tue, 29 Nov 2022 09:33:45 -0700
From: David Ahern <dsahern@...nel.org>
To: Duoming Zhou <duoming@....edu.cn>, linux-kernel@...r.kernel.org
Cc: davem@...emloft.net, yoshfuji@...ux-ipv6.org, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org
Subject: Re: [PATCH net] net: Add a gfp_t parameter in ip_fib_metrics_init to
support atomic context
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
>
Powered by blists - more mailing lists