From: David Miller <davem@davemloft.net>
To: likaige@loongson.cn
Cc: benve@cisco.com, _govind@gmx.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, lixuefeng@loongson.cn,
yangtiezhu@loongson.cn
Subject: Re: [PATCH RESEND] net/cisco: Fix a sleep-in-atomic-context bug in enic_init_affinity_hint()
Date: Tue, 23 Jun 2020 14:33:11 -0700 (PDT) [thread overview]
Message-ID: <20200623.143311.995885759487352025.davem@davemloft.net> (raw)
In-Reply-To: <1592899989-22049-1-git-send-email-likaige@loongson.cn>
From: Kaige Li <likaige@loongson.cn>
Date: Tue, 23 Jun 2020 16:13:09 +0800
> The kernel module may sleep with holding a spinlock.
>
> The function call paths (from bottom to top) are:
>
> [FUNC] zalloc_cpumask_var(GFP_KERNEL)
> drivers/net/ethernet/cisco/enic/enic_main.c, 125: zalloc_cpumask_var in enic_init_affinity_hint
> drivers/net/ethernet/cisco/enic/enic_main.c, 1918: enic_init_affinity_hint in enic_open
> drivers/net/ethernet/cisco/enic/enic_main.c, 2348: enic_open in enic_reset
> drivers/net/ethernet/cisco/enic/enic_main.c, 2341: spin_lock in enic_reset
>
> To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC.
>
> Signed-off-by: Kaige Li <likaige@loongson.cn>
Just grepping around for GFP_KERNEL usage in atomic contexts I guess
is fine.
But you really have to look at the bigger picture.
Calling a NIC driver open function from a context holding a spinlock
is very much the real problem, so many operations have to sleep and
in face that ->ndo_open() method is defined as being allowed to sleep
and that's why the core networking never invokes it with spinlocks
held.
next prev parent reply other threads:[~2020-06-23 21:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 8:13 Kaige Li
2020-06-23 20:50 ` Jakub Kicinski
2020-06-24 2:07 ` Kaige Li
2020-06-24 3:24 ` David Miller
2020-06-23 21:33 ` David Miller [this message]
2020-06-23 22:26 ` David Miller
2020-06-24 1:56 ` Kaige Li
2020-06-24 3:23 ` David Miller
2020-06-24 3:41 ` Kaige Li
2020-06-24 6:32 ` Christian Benvenuti (benve)
2020-06-24 16:59 ` Jakub Kicinski
2020-07-03 6:54 ` Kaige Li
-- strict thread matches above, loose matches on Subject: below --
2020-06-22 13:11 Kaige Li
2020-06-23 4:09 ` David Miller
2020-06-23 8:02 ` Kaige Li
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=20200623.143311.995885759487352025.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=_govind@gmx.com \
--cc=benve@cisco.com \
--cc=likaige@loongson.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--cc=netdev@vger.kernel.org \
--cc=yangtiezhu@loongson.cn \
/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®