From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933587AbcIEP0K (ORCPT ); Mon, 5 Sep 2016 11:26:10 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:35220 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932448AbcIEP0H (ORCPT ); Mon, 5 Sep 2016 11:26:07 -0400 From: Colin King To: Keith Busch , Jens Axboe , linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] nvme-rdma: fix null pointer dereference on req->mr Date: Mon, 5 Sep 2016 16:24:38 +0100 Message-Id: <20160905152438.14299-1-colin.king@canonical.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King If there is an error on req->mr, req->mr is set to null, however the following statement sets req->mr->need_inval causing a null pointer dereference. Fix this by bailing out to label 'out' to immediately return and hence skip over the offending null pointer dereference. Fixes: f5b7b559e1488 ("nvme-rdma: Get rid of duplicate variable") Signed-off-by: Colin Ian King --- drivers/nvme/host/rdma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index ab545fb..162b8c0 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -291,6 +291,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) if (IS_ERR(req->mr)) { ret = PTR_ERR(req->mr); req->mr = NULL; + goto out; } req->mr->need_inval = false; -- 2.9.3