Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95423C43219 for ; Wed, 24 Nov 2021 13:06:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345565AbhKXNJa (ORCPT ); Wed, 24 Nov 2021 08:09:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:45298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347124AbhKXNHK (ORCPT ); Wed, 24 Nov 2021 08:07:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A504261A0D; Wed, 24 Nov 2021 12:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637757505; bh=Y9afLT4371TGlFudsxLM9JlBme7rSHZEM9sLFe9lq00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/74w4ZzngnTaaP1FLy+NcfI5UiPxIHtgmTXlCMfkpHnh9gJJi7WzuBioL8BfprqO U6+xymAyuthJBfs9Vj7guQ6/htBBLALdpKRZuKgsyPFMpWYmcYVkykdl55CCFNrwnE ORopxBxscgg3Mkj8dxjxf7Fy1Qo/2bKbdad1Xhp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Gurtovoy , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.19 158/323] nvme-rdma: fix error code in nvme_rdma_setup_ctrl Date: Wed, 24 Nov 2021 12:55:48 +0100 Message-Id: <20211124115724.261886828@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115718.822024889@linuxfoundation.org> References: <20211124115718.822024889@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Max Gurtovoy [ Upstream commit 09748122009aed7bfaa7acc33c10c083a4758322 ] In case that icdoff is not zero or mandatory keyed sgls are not supported by the NVMe/RDMA target, we'll go to error flow but we'll return 0 to the caller. Fix it by returning an appropriate error code. Fixes: c66e2998c8ca ("nvme-rdma: centralize controller setup sequence") Signed-off-by: Max Gurtovoy Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/rdma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index ffd6a7204509a..1f41cf80f827c 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -967,11 +967,13 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new) return ret; if (ctrl->ctrl.icdoff) { + ret = -EOPNOTSUPP; dev_err(ctrl->ctrl.device, "icdoff is not supported!\n"); goto destroy_admin; } if (!(ctrl->ctrl.sgls & (1 << 2))) { + ret = -EOPNOTSUPP; dev_err(ctrl->ctrl.device, "Mandatory keyed sgls are not supported!\n"); goto destroy_admin; -- 2.33.0