From: Matias Bjørling Date: Sun, 6 Dec 2015 10:25:46 +0000 (+0100) Subject: lightnvm: check mm before use X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=437f8f9a1e923deab6c61822c36f29f4a2198cfe;p=linux-beck.git lightnvm: check mm before use The core can may issue I/Os before a media manager is registered with the lightnvm subsystem. Make sure that we don't call the media manager ->end_io prematurely with a null pointer. Signed-off-by: Matias Bjørling Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 06c336410235..762c9a7cbfa6 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -455,7 +455,7 @@ static void nvme_nvm_end_io(struct request *rq, int error) struct nvm_rq *rqd = rq->end_io_data; struct nvm_dev *dev = rqd->dev; - if (dev->mt->end_io(rqd, error)) + if (dev->mt && dev->mt->end_io(rqd, error)) pr_err("nvme: err status: %x result: %lx\n", rq->errors, (unsigned long)rq->special);