* [PATCH] mm/vmalloc: bail out early on invalid page_shift in __vmap_pages_range_noflush()
@ 2026-10-03 9:04 Wen Jiang
2026-10-03 10:02 ` Barry Song
0 siblings, 1 reply; 4+ messages in thread
From: Wen Jiang @ 2026-10-03 9:04 UTC (permalink / raw)
To: akpm
Cc: urezki, dev.jain, baohua, linux-mm, linux-kernel, Wen Jiang, Wen Jiang
__vmap_pages_range_noflush() currently only warns when page_shift is
smaller than PAGE_SHIFT, then continues with the invalid shift. Return
-EINVAL instead so the bogus argument is caught immediately.
Suggested-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Wen Jiang <jiangwen6@xiaomi.com>
---
mm/vmalloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index bea9f76ed7e7..838c8e0ccfe9 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -684,7 +684,8 @@ int __vmap_pages_range_noflush(unsigned long addr, unsigned long end,
{
unsigned int i, nr = (end - addr) >> PAGE_SHIFT;
- WARN_ON(page_shift < PAGE_SHIFT);
+ if (WARN_ON_ONCE(page_shift < PAGE_SHIFT))
+ return -EINVAL;
if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMALLOC) ||
page_shift == PAGE_SHIFT)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm/vmalloc: bail out early on invalid page_shift in __vmap_pages_range_noflush()
2026-10-03 9:04 [PATCH] mm/vmalloc: bail out early on invalid page_shift in __vmap_pages_range_noflush() Wen Jiang
@ 2026-10-03 10:02 ` Barry Song
2026-10-03 14:55 ` Uladzislau Rezki
2026-10-04 6:34 ` Wen Jiang
0 siblings, 2 replies; 4+ messages in thread
From: Barry Song @ 2026-10-03 10:02 UTC (permalink / raw)
To: Wen Jiang; +Cc: akpm, urezki, dev.jain, linux-mm, linux-kernel, Wen Jiang
On Sat, Oct 3, 2026 at 5:05 PM Wen Jiang <jiangwenxiaomi@gmail.com> wrote:
>
> __vmap_pages_range_noflush() currently only warns when page_shift is
> smaller than PAGE_SHIFT, then continues with the invalid shift. Return
> -EINVAL instead so the bogus argument is caught immediately.
>
> Suggested-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Wen Jiang <jiangwen6@xiaomi.com>
I have checked this carefully and confirmed that this is a correct cleanup.
However, when I applied your patch, I noticed that the author and
Signed-off-by do not match.
Author: Wen Jiang <jiangwenxiaomi@gmail.com>
Date: Sat Oct 3 17:04:30 2026 +0800
mm/vmalloc: bail out early on invalid page_shift in
__vmap_pages_range_noflush()
...
Signed-off-by: Wen Jiang <jiangwen6@xiaomi.com>
So please send a v2 to fix this, and feel free to include:
Reviewed-by: Barry Song <baohua@kernel.org>
Best Regards
Barry
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm/vmalloc: bail out early on invalid page_shift in __vmap_pages_range_noflush()
2026-10-03 10:02 ` Barry Song
@ 2026-10-03 14:55 ` Uladzislau Rezki
2026-10-04 6:34 ` Wen Jiang
1 sibling, 0 replies; 4+ messages in thread
From: Uladzislau Rezki @ 2026-10-03 14:55 UTC (permalink / raw)
To: Barry Song, Wen Jiang
Cc: Wen Jiang, akpm, urezki, dev.jain, linux-mm, linux-kernel, Wen Jiang
On Sat, Oct 03, 2026 at 06:02:37PM +0800, Barry Song wrote:
> On Sat, Oct 3, 2026 at 5:05 PM Wen Jiang <jiangwenxiaomi@gmail.com> wrote:
> >
> > __vmap_pages_range_noflush() currently only warns when page_shift is
> > smaller than PAGE_SHIFT, then continues with the invalid shift. Return
> > -EINVAL instead so the bogus argument is caught immediately.
> >
> > Suggested-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> > Signed-off-by: Wen Jiang <jiangwen6@xiaomi.com>
>
> I have checked this carefully and confirmed that this is a correct cleanup.
>
> However, when I applied your patch, I noticed that the author and
> Signed-off-by do not match.
>
> Author: Wen Jiang <jiangwenxiaomi@gmail.com>
> Date: Sat Oct 3 17:04:30 2026 +0800
>
> mm/vmalloc: bail out early on invalid page_shift in
> __vmap_pages_range_noflush()
> ...
> Signed-off-by: Wen Jiang <jiangwen6@xiaomi.com>
>
>
> So please send a v2 to fix this, and feel free to include:
>
> Reviewed-by: Barry Song <baohua@kernel.org>
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/vmalloc: bail out early on invalid page_shift in __vmap_pages_range_noflush()
2026-10-03 10:02 ` Barry Song
2026-10-03 14:55 ` Uladzislau Rezki
@ 2026-10-04 6:34 ` Wen Jiang
1 sibling, 0 replies; 4+ messages in thread
From: Wen Jiang @ 2026-10-04 6:34 UTC (permalink / raw)
To: baohua
Cc: akpm, dev.jain, jiangwen6, jiangwenxiaomi, linux-kernel,
linux-mm, urezki
> I have checked this carefully and confirmed that this is a correct cleanup.
>
> However, when I applied your patch, I noticed that the author and
> Signed-off-by do not match.
>
> Author: Wen Jiang <jiangwenxiaomi@gmail.com>
> Date: Sat Oct 3 17:04:30 2026 +0800
>
> mm/vmalloc: bail out early on invalid page_shift in
> __vmap_pages_range_noflush()
> ...
> Signed-off-by: Wen Jiang <jiangwen6@xiaomi.com>
>
Hi Barry,
I'll send a v2 separately with jiangwen6@xiaomi.com
for both the author and Signed-off-by.
Thanks,
Wen
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-04 6:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-03 9:04 [PATCH] mm/vmalloc: bail out early on invalid page_shift in __vmap_pages_range_noflush() Wen Jiang
2026-10-03 10:02 ` Barry Song
2026-10-03 14:55 ` Uladzislau Rezki
2026-10-04 6:34 ` Wen Jiang
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®