Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1307032

[PATCH 03/25] lightnvm: add check after mempool allocation

From Matias Bjørling <m@bjorling.me>
Newsgroups linux.kernel
Subject [PATCH 03/25] lightnvm: add check after mempool allocation
Date 2016-01-12 08:00 +0100
Message-ID <qQ15W-5F9-41@gated-at.bofh.it> (permalink)
References <qQ15T-5F9-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Javier Gonzalez <javier@javigon.com>

The mempool allocation might fail. Make sure to return error when it
does, instead of causing a kernel panic.

Signed-off-by: Javier Gonzalez <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/lightnvm/rrpc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index a1e7488..f4bc986 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -287,6 +287,8 @@ static int rrpc_move_valid_pages(struct rrpc *rrpc, struct rrpc_block *rblk)
 	}
 
 	page = mempool_alloc(rrpc->page_pool, GFP_NOIO);
+	if (!page)
+		return -ENOMEM;
 
 	while ((slot = find_first_zero_bit(rblk->invalid_pages,
 					    nr_pgs_per_blk)) < nr_pgs_per_blk) {
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/25] LightNVM patches for 4.5 Matias Bjørling <m@bjorling.me> - 2016-01-12 08:00 +0100
  [PATCH 24/25] lightnvm: use system block for mm initialization Matias Bjørling <m@bjorling.me> - 2016-01-12 08:00 +0100
  [PATCH 03/25] lightnvm: add check after mempool allocation Matias Bjørling <m@bjorling.me> - 2016-01-12 08:00 +0100
  [PATCH 07/25] lightnvm: refactor end_io functions for sync Matias Bjørling <m@bjorling.me> - 2016-01-12 08:00 +0100
  [PATCH 20/25] lightnvm: add mccap support Matias Bjørling <m@bjorling.me> - 2016-01-12 08:00 +0100
  [PATCH 05/25] lightnvm: move ppa erase logic to core Matias Bjørling <m@bjorling.me> - 2016-01-12 08:00 +0100
  [PATCH 09/25] lightnvm: check bi_error in gc Matias Bjørling <m@bjorling.me> - 2016-01-12 08:00 +0100
  [PATCH 22/25] lightnvm: core on-disk initialization Matias Bjørling <m@bjorling.me> - 2016-01-12 08:00 +0100
  Re: [PATCH 00/25] LightNVM patches for 4.5 Jens Axboe <axboe@fb.com> - 2016-01-12 16:20 +0100
    Re: [PATCH 00/25] LightNVM patches for 4.5 Matias Bjorling <m@bjorling.me> - 2016-01-13 01:10 +0100

csiph-web