linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: zhangchun <zhang.chuna@h3c.com>
To: <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	<jiaoxupo@h3c.com>, <shaohaojize@126.com>, <zhang.chuna@h3c.com>
Subject: [PATCH] use might_sleep check if kmap_high is called from atomic context
Date: Tue, 20 Aug 2024 09:53:11 +0800	[thread overview]
Message-ID: <1724118791-51554-1-git-send-email-zhang.chuna@h3c.com> (raw)

kmap_high is defined as EXPORT_SYMBOL, and cannot be called from atomic
context. Add might_sleep check is necessary.
Signed-off-by: zhangchun <zhang.chuna@h3c.com>
---
 mm/highmem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/highmem.c b/mm/highmem.c
index 07f2c67..5cfb5a9 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -319,6 +319,11 @@ void *kmap_high(struct page *page)
 	unsigned long vaddr;
 
 	/*
+	 * Use might_sleep to check if kmap_high is called
+	 * from atomic context.
+	 */
+	might_sleep();
+	/*
 	 * For highmem pages, we can't trust "virtual" until
 	 * after we have the lock.
 	 */
-- 
1.8.3.1



             reply	other threads:[~2024-08-20  1:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  1:53 zhangchun [this message]
2024-08-20  3:24 ` Matthew Wilcox
2024-08-20  6:33   ` zhangchun

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=1724118791-51554-1-git-send-email-zhang.chuna@h3c.com \
    --to=zhang.chuna@h3c.com \
    --cc=akpm@linux-foundation.org \
    --cc=jiaoxupo@h3c.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shaohaojize@126.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