Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp913355rdb; Tue, 30 Jan 2024 02:22:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdv4FHtFd5ql7XltfCrOyNHckpOKtNMOJqcJYKi2WFleydo6YL3viv6iYda2KN3uQT7my6 X-Received: by 2002:a05:6870:47a4:b0:206:a798:8d88 with SMTP id c36-20020a05687047a400b00206a7988d88mr3876938oaq.29.1706610131560; Tue, 30 Jan 2024 02:22:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706610131; cv=pass; d=google.com; s=arc-20160816; b=h4r9QWRqns5tClRKTIqS5f8pVZJuJDUG5uCtTAEETkbIN2fXR/Maq+DbEg9F1RJX9l u7AS88c35ym2ZLQyeXiJlgxi0T3d7i7ERLcY4y0g5qkTa7KzDPQfFepOJEuDGGh6WuYW YswLirZdh8cSSh1Hu8Z9CUt9Fhmme4BLlatUDlmvAVdP2vtQZSdMlRZIit+CUh/yvJQj mgUiHHl3xTcVn7BHnLASFCGH3dGNHxfyOcQ7GVsz8IjYXYCbhV/lXTZJoIjXfSXZ9SlX v25fl8/34GGcVv8zChbwObMG9kZIy5zlHI7xbTZk1Thtv2at2pDFlxicNlTWJVnSdPK6 Cxsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=BSvgt35Kdc/PmYUOYaVWdJvvCorFPrHxhpJEVx5L1LU=; fh=n5BdL0bf9gAg+lJbD9hdO95/5FlrOLRCMPX4XUPPjVI=; b=JzkH6zBOKZY+Xj6dFuVWjM3OTadArz9ajnNjZSLGctnoPPFP1oZkQQO2GRfm5/FQGc wsPZezM4CcZDDRj5tuTwayF6r5fbSvhfyUoaDc5l6iDJtn1JMPzOgsu7e28WP4uDyQ2j CN+U+yBXJnkbSSnA8k7/iO2tVwKR+RXh8ThS5HKKCPJOjd01vY84Ly9lqUcqj8ebeEQ0 n8Y0aGQjwZgp34honSjT4XS5m29stwTFg+t6O4K4ID9vwIowkWSfqiWn1KoTm4AonLI5 y/Yywxu2R6RucSTHpDOsfJpEz74sxPpmxxJYNcOyNEYtsVpF4G99Ei0reUVlGTtQvLpe Z6KA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-44312-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44312-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u2-20020a656702000000b005cdff1f4816si5610954pgf.424.2024.01.30.02.22.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:22:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44312-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-44312-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44312-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D8E3AB2F74F for ; Tue, 30 Jan 2024 09:53:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D3356A01A; Tue, 30 Jan 2024 09:49:57 +0000 (UTC) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 565BF679FF for ; Tue, 30 Jan 2024 09:49:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608196; cv=none; b=XY/rSwVkiH10EazlLGPBJq8PFp638eDqIHX0UGqtc1uYtBXulmY3mgMGPXrT0uWcN40ivxfsxG/SczR0BpQmt75F2+xUCO9jG6GnRVmy+YfS+qAaBfvyRI0/5FK/8HZeWGIPAmkI2xjDU0pBQRAaC3pHH2pP8SjtBTW9vZmQ4oo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608196; c=relaxed/simple; bh=CHEe3BgyB5vNBsrIi37+8+stLpieh300FXdpijsIshU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h5KRCNhTMwu/005J70/JzPCgB4VhvzYNcRhZLrmdhOmrdPA3UsGzjPNEZdAlqYlu200DpR5uVaVXpyCejy42ZWCe8R1dDZ17khwJ6gcUHF16BiecBQzeKVE/mZvG55E8yxrpYNS8E4NyYMA7E7jyPWYJh/DF4m2G9XZXfZGjj0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A3F601F842; Tue, 30 Jan 2024 09:49:53 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 9155E13462; Tue, 30 Jan 2024 09:49:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id X/UIIkHGuGWZbwAAn2gu4w (envelope-from ); Tue, 30 Jan 2024 09:49:53 +0000 From: Daniel Wagner To: James Smart Cc: Keith Busch , Christoph Hellwig , Hannes Reinecke , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Wagner Subject: [PATCH v4 09/12] nvmet-fc: abort command when there is no binding Date: Tue, 30 Jan 2024 10:49:35 +0100 Message-ID: <20240130094938.1575-10-dwagner@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130094938.1575-1-dwagner@suse.de> References: <20240130094938.1575-1-dwagner@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Level: Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: A3F601F842 X-Spam-Flag: NO When the target port has not active port binding, there is no point in trying to process the command as it has to fail anyway. Instead adding checks to all commands abort the command early. Reviewed-by: Hannes Reinecke Signed-off-by: Daniel Wagner --- drivers/nvme/target/fc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index fe3246024836..c80b8a066fd1 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -1099,6 +1099,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) int idx; bool needrandom = true; + if (!tgtport->pe) + return NULL; + assoc = kzalloc(sizeof(*assoc), GFP_KERNEL); if (!assoc) return NULL; @@ -2514,8 +2517,9 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, fod->req.cmd = &fod->cmdiubuf.sqe; fod->req.cqe = &fod->rspiubuf.cqe; - if (tgtport->pe) - fod->req.port = tgtport->pe->port; + if (!tgtport->pe) + goto transport_error; + fod->req.port = tgtport->pe->port; /* clear any response payload */ memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf)); -- 2.43.0