lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210618151436.38217-1-wanjiabing@vivo.com>
Date:   Fri, 18 Jun 2021 23:14:36 +0800
From:   Wan Jiabing <wanjiabing@...o.com>
To:     Dennis Zhou <dennis@...nel.org>, Tejun Heo <tj@...nel.org>,
        Christoph Lameter <cl@...ux.com>,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Cc:     kael_w@...h.net, Wan Jiabing <wanjiabing@...o.com>
Subject: [PATCH] mm/percpu: Fix gfp flag in pcpu_balance_populated

Fix coccicheck warning:

./mm/percpu.c:2045:19-29: ERROR: function pcpu_balance_populated
called on line 2232 inside lock on line 2228 but uses GFP_KERNEL

When pcpu_balance_populated() is called in pcpu_balance_workfn(),
it helds spin_lock but use GFP_KERNEL to alloc mem, which is unsafe.

Signed-off-by: Wan Jiabing <wanjiabing@...o.com>
---
 mm/percpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index b4cebeca4c0c..4031f32e6975 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2042,7 +2042,7 @@ static void pcpu_balance_free(bool empty_only)
 static void pcpu_balance_populated(void)
 {
 	/* gfp flags passed to underlying allocators */
-	const gfp_t gfp = GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN;
+	const gfp_t gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN;
 	struct pcpu_chunk *chunk;
 	int slot, nr_to_pop, ret;
 
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ