patch "staging: erofs: fix to handle error path of erofs_vmap()" added to staging-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
staging: erofs: fix to handle error path of erofs_vmap()
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 8bce6dcede65139a087ff240127e3f3c01363eed Mon Sep 17 00:00:00 2001
From: Chao Yu <[email protected]>
Date: Mon, 11 Mar 2019 23:10:10 +0800
Subject: staging: erofs: fix to handle error path of erofs_vmap()
erofs_vmap() wrapped vmap() and vm_map_ram() to return virtual continuous memory, but both of them can failed due to a lot of reason, previously, erofs_vmap()'s callers didn't handle them, which can potentially cause NULL pointer access, fix it.
--- drivers/staging/erofs/unzip_vle.c | 4 ++++ drivers/staging/erofs/unzip_vle_lz4.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/staging/erofs/unzip_vle.c +4 -0
@@ -1029,6 +1029,10 @@ static int z_erofs_vle_unzip(struct super_block *sb, skip_allocpage: vout =erofs_vmap (pages, nr_pages); +if (!vout) { + err = -ENOMEM ; + goto out; + } err =z_erofs_vle_unzip_vmap (compressed_pages, clusterpages, vout, llen, work->pageofs, overlapped);
drivers/staging/erofs/unzip_vle_lz4.c +5 -2
@@ -136,10 +136,13 @@ int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages, nr_pages =DIV_ROUND_UP (outlen + pageofs,PAGE_SIZE ); -if (clusterpages ==1 ) +if (clusterpages ==1 ) { vin =kmap_atomic (compressed_pages[0 ]); -else + }else { vin =erofs_vmap (compressed_pages, clusterpages); +if (!vin) +return -ENOMEM ; + }preempt_disable (); vout = erofs_pcpubuf[smp_processor_id ()].data;
Signature · 1 line
2.21.0