lightnvm updates for 5.3
Hi Jens,
A couple of patches for the 5.3 window. Geert fixed an uninitialized pointer bug, and Heiner fixed up a bug when merging bio pages in pblk.
Thank you,
Matias
Geert Uytterhoeven (1):
lightnvm: fix uninitialized pointer in nvm_remove_tgt()
Heiner Litz (1):
lightnvm: pblk: fix freeing of merged pages
drivers/lightnvm/core.c | 2 +- drivers/lightnvm/pblk-core.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-)
Signature · 1 line
2.19.1
[GIT PULL 1/2] lightnvm: pblk: fix freeing of merged pages
From: Heiner Litz <[email protected]>
bio_add_pc_page() may merge pages when a bio is padded due to a flush. Fix iteration over the bio to free the correct pages in case of a merge.
--- drivers/lightnvm/pblk-core.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/lightnvm/pblk-core.c +9 -7
@@ -323,14 +323,16 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, int type)void pblk_bio_free_pages (struct pblk *pblk,struct bio *bio,int off,int nr_pages) { -struct bio_vec bv; -int i; +struct bio_vec *bv; +struct page *page; +int i, e, nbv =0 ; -WARN_ON (off + nr_pages != bio->bi_vcnt); - -for (i = off; i < nr_pages + off; i++) { - bv = bio->bi_io_vec[i]; -mempool_free (bv.bv_page, &pblk->page_bio_pool); +for (i =0 ; i < bio->bi_vcnt; i++) { + bv = &bio->bi_io_vec[i]; + page = bv->bv_page; +for (e =0 ; e < bv->bv_len; e +=PBLK_EXPOSED_PAGE_SIZE , nbv++) +if (nbv >= off) +mempool_free (page++, &pblk->page_bio_pool); } }
Signature · 1 line
2.19.1
[GIT PULL 2/2] lightnvm: fix uninitialized pointer in nvm_remove_tgt()
In reply to Matias BjørlingFrom: Geert Uytterhoeven <[email protected]>
With gcc 4.1:
drivers/lightnvm/core.c: In function ‘nvm_remove_tgt’:
drivers/lightnvm/core.c:510: warning: ‘t’ is used uninitialized in this function
Indeed, if no NVM devices have been registered, t will be an uninitialized pointer, and may be dereferenced later. A call to nvm_remove_tgt() can be triggered from userspace by issuing the NVM_DEV_REMOVE ioctl on the lightnvm control device.
Fix this by preinitializing t to NULL.
--- drivers/lightnvm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/lightnvm/core.c +1 -1
@@ -478,7 +478,7 @@ static void __nvm_remove_target(struct nvm_target *t, bool graceful)*/ static int nvm_remove_tgt (struct nvm_ioctl_remove *remove) { -struct nvm_target *t; +struct nvm_target *t =NULL ;struct nvm_dev *dev;down_read (&nvm_lock);
Signature · 1 line
2.19.1
Jens Axboe
AppliedQuoted 4 lines · Matias Bjørling
Hi Jens,
A couple of patches for the 5.3 window. Geert fixed an uninitialized pointer bug, and Heiner fixed up a bug when merging bio pages in pblk.
Applied, thanks.
Signature · 1 line
Jens Axboe