* + mm-vmalloc-fix-return-value-of-vb_alloc-if-size-is-0.patch added to mm-hotfixes-unstable branch
@ 2024-04-26 19:13 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-04-26 19:13 UTC (permalink / raw)
To: mm-commits, urezki, lstoakes, hch, baohua, hailong.liu, akpm
The patch titled
Subject: mm/vmalloc: fix return value of vb_alloc if size is 0
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-vmalloc-fix-return-value-of-vb_alloc-if-size-is-0.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmalloc-fix-return-value-of-vb_alloc-if-size-is-0.patch
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: "Hailong.Liu" <hailong.liu@oppo.com>
Subject: mm/vmalloc: fix return value of vb_alloc if size is 0
Date: Fri, 26 Apr 2024 10:41:49 +0800
vm_map_ram() uses IS_ERR() to validate the return value of vb_alloc(). If
vm_map_ram(page, 0, 0) is executed, vb_alloc(0, GFP_KERNEL) would return
NULL. In such a case, IS_ERR() cannot handle the return value and lead to
kernel panic by vmap_pages_range_noflush() at last. To resolve this
issue, return ERR_PTR(-EINVAL) if the size is 0.
Link: https://lkml.kernel.org/r/20240426024149.21176-1-hailong.liu@oppo.com
Reviewed-by: Barry Song <baohua@kernel.org>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Hailong.Liu <hailong.liu@oppo.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/vmalloc.c~mm-vmalloc-fix-return-value-of-vb_alloc-if-size-is-0
+++ a/mm/vmalloc.c
@@ -2710,7 +2710,7 @@ static void *vb_alloc(unsigned long size
* get_order(0) returns funny result. Just warn and terminate
* early.
*/
- return NULL;
+ return ERR_PTR(-EINVAL);
}
order = get_order(size);
_
Patches currently in -mm which might be from hailong.liu@oppo.com are
mm-vmalloc-fix-return-value-of-vb_alloc-if-size-is-0.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-26 19:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-26 19:13 + mm-vmalloc-fix-return-value-of-vb_alloc-if-size-is-0.patch added to mm-hotfixes-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.