Commit ac0476e
mm/vmalloc: fix return value of vb_alloc if size is 0
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/[email protected]
Reviewed-by: Barry Song <[email protected]>
Reviewed-by: Uladzislau Rezki (Sony) <[email protected]>
Signed-off-by: Hailong.Liu <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 30153e4 commit ac0476e
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2710 | 2710 | | |
2711 | 2711 | | |
2712 | 2712 | | |
2713 | | - | |
| 2713 | + | |
2714 | 2714 | | |
2715 | 2715 | | |
2716 | 2716 | | |
| |||
0 commit comments