Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2483949pxj; Mon, 10 May 2021 04:12:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQfuO5T69hwganL3QGG42OwivId263oUp9WrwzCs8x65kTy19OAi8bHIkZR6okHC6/ANRc X-Received: by 2002:a6b:d309:: with SMTP id s9mr17280901iob.186.1620645130332; Mon, 10 May 2021 04:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645130; cv=none; d=google.com; s=arc-20160816; b=Pqgi1uG8GsRe4Ea+CzIeyPf73ECq68GWdh+BVl3yhTsaEmFhzHxS4DXfjRzm4DYN/f uTbGffCxw9dV2V9sYNkP+lXM3dgd3G0j7xTO8irZkEncVlR3qMxvTb8bzqTHDz7a2OtI gw/xpa6P1ebk9/lTq5Jae+QWx9uI9VEqjQ5ELoMyWgrABbb8iB0mNUeVuhpxAci4B+SZ oiWjkcCL2Y/77pBuSqGGhpJr+4fsvXwPTXrw62ZIrhKh7AwvZxEpcmVog5hVYdCCyXY3 h2Bw4ic+jAZOhdr6N6SapZSXsKBUbhg4JPu/P2BMxEtaYsVHTFdV46ecgB6ExKhSQggk c7vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aEyDV5R04m7PdxdCW7eEVc8Swo+RTnMiDA5kKwdEIgc=; b=mEZvROF0R1xy0F8tIHeqaE4bAfmuu2fmsTNPlwYYkZEPpAoVL7a1lSZ8Hp6+c+f1sO hnEetGCFO0QvFuCS+5Xttfe5dbHTtCR/vvfMri8+azx0D7VWwlwGpUoK58FkjKA7U4Fc GTl/W7tqyhnwUD284VbpaFB/vGojgCG0eI2yVz3cndDI9W/XiZhhKr5WM0sGj8cXGtHu Z1HE0PIjYC4+FrVfcfVzOxXjznOpgBQJ9MDucl8Tag5lsNWIRfYwAx5BAsV9xdgYKV0v GbRZYIK9FiDLvbwFNPir8eww7NWuIkK7oPiVKF1yHZ9Un5y8bWXcGKMHnsvLlzdMP7YO MyAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tJYeGE19; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si14596327jam.34.2021.05.10.04.11.57; Mon, 10 May 2021 04:12:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tJYeGE19; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236252AbhEJLHp (ORCPT + 99 others); Mon, 10 May 2021 07:07:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:32908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbhEJKrk (ORCPT ); Mon, 10 May 2021 06:47:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F63E61483; Mon, 10 May 2021 10:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643050; bh=6XVWpkye2Xxg9jssibcOvAAh2BEuCmu5Z3frUpURdb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJYeGE19M/xXH+WQhauWJmiEyc9aLOH7MAx6y5PijQk28gjf7Xn7ch0/QBmurBk8u 7980FFr9kvv2xyw5xSx6CudidkwdbFoA7EPENdLovcQ7QZnjghq6PJhpiGzgKbuQyD sTNiwZH/1Mo9V+qhryg4tLYcrbS8eHrERTphNmZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Pu , Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.10 156/299] nvmet: return proper error code from discovery ctrl Date: Mon, 10 May 2021 12:19:13 +0200 Message-Id: <20210510102010.116851297@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Hou Pu [ Upstream commit 79695dcd9ad4463a82def7f42960e6d7baa76f0b ] Return NVME_SC_INVALID_FIELD from discovery controller like normal controller when executing identify or get log page command. Signed-off-by: Hou Pu Reviewed-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/target/discovery.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c index f40c05c33c3a..5b8ee824b100 100644 --- a/drivers/nvme/target/discovery.c +++ b/drivers/nvme/target/discovery.c @@ -177,12 +177,14 @@ static void nvmet_execute_disc_get_log_page(struct nvmet_req *req) if (req->cmd->get_log_page.lid != NVME_LOG_DISC) { req->error_loc = offsetof(struct nvme_get_log_page_command, lid); - status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR; + status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; goto out; } /* Spec requires dword aligned offsets */ if (offset & 0x3) { + req->error_loc = + offsetof(struct nvme_get_log_page_command, lpo); status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; goto out; } @@ -249,7 +251,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req) if (req->cmd->identify.cns != NVME_ID_CNS_CTRL) { req->error_loc = offsetof(struct nvme_identify, cns); - status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR; + status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; goto out; } -- 2.30.2