From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49]) (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 01DB521576E for ; Wed, 4 Feb 2026 00:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770165861; cv=none; b=IsOWNwEeMfu7z6fmEIZCGx+3UQjSuAYADFnAIFTaOdXGz7HtRDHPfxYxIwLzr0fnJNAqQQXFDskSG//noKYNTEfTxQQ4XNBJTdIj4mUFBr+U5saWu+rxxJnCbrYBjLTS/l81X3A0vprt/1rfBvXSv5mHWx/zQQwOJF0w6qlioUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770165861; c=relaxed/simple; bh=W0aU9b+a+Q3lYttuZZOUZnVQPSMC7aQioJJY51YAr4Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=U5jC4VhzeSXRv18nmdBXShdtbHIdxtYrAS9tzRuH3PpQ7S9I98OqqNkB51Zd9pF819U9CCdWyh2uERLiE6Ym7kJLDAyReHUmhEpwyxDcqza5FjdwN5ITE+ZqSWDzeUZV/kDX8kS2OmyZzpSuwaAUEbjNaWPMd/RDy9xTmlL90GE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=OED3OcxL; arc=none smtp.client-ip=74.125.82.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="OED3OcxL" Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-124a635476fso9247139c88.0 for ; Tue, 03 Feb 2026 16:44:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1770165859; x=1770770659; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=IrMlnCSR3aMEJwapKkMfRkB9Q4sVEd0XSvOGMzL5MAw=; b=OED3OcxL2AfwSPLCH1RJmWphRpOlDXvnaEPBpjV0wlLGH3s3YcM9slg9HLpVkagP9S d545DEn7D/38KNIJXjc3KyYTSv11QzkVvJAJmke9w8KomfWcbWMK5ks1h8nNT8mHYnuI TpBFX5RoA1xq1uz0YuhTXKaGKw02CRHtoPV89cnrFMnkTWrCeI5Y2hRM2QycdBrtTlio WIyVG2EEtAADfyhbmviIlJ99OOaFMRqFUxpLElrcGXERDVdFIN+QRE0WVSp70UyNjUwc EimTp6s4O3S4shnG2w1HI9ZI5erc0BPpr0mcD/TlrP+Phc1InReUFLE8j8Q/QI4WnogQ jOig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770165859; x=1770770659; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IrMlnCSR3aMEJwapKkMfRkB9Q4sVEd0XSvOGMzL5MAw=; b=DhSPkKRa798BWhU3g1d6oxx43Yy9NkadWt5HNVfXo9a++vK7Dqvbw13HMVfJdDw9s0 ZMxu+rwSxt1lO95ODlO14FrUFmASb4fkSLtJlztQzy3n6WYxAgC2iqxUCW/R5WhWK96z hcIOG6yW2vXWArZW4W9AxLeNbYvnTiilhy8DN6srieApUqQAL3LUWP1S5odtdXQdTKJJ N6id0dLgaayZdjRcz1SYAyG6vXXilhn915dx9200Sdf2zjnH85QtSAAtJ2TBpt4ZAg6e diqjagVwLsbitqhJOlIDTgP7JOglMYYaxumobjQKb0DF4H/jh5wv7/JI1wUZJpvIbfy9 s4Dg== X-Forwarded-Encrypted: i=1; AJvYcCUEiBhYrI3bDCiBd4LwShwKocKHIyqW60PL2jqfkHy8hjrPMebRMjPWqciaJs0lqnSybeRI5aXTLBzoK7o=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1hWIx/arZe4tsBtdnMSJByK6Otll8EeAgQmrFgHl9Cee85NdO p0+oPJOcHDnh8T5cKDAD1DTo8cedVL8SDflRDwMMxBjJTIdsDHAff/do6nuaH5zeBvQ= X-Gm-Gg: AZuq6aL4fabsCfWRcNIKluCAqwVv8exN96RzGKvhgLyRRhU57zgSX8c4qhRtypE4bLs 85q/F3874brgkaYUge0A9RzpBeA7iewFx6llBOgNwvmWSkTypw23EzWuntWIuXEFpDNnMLo28SG TTaLrJVmcofsQi1gHC3lRtl4QGSQzy1ZiHyWOeGPHTCUmtoLn38GWTMYj+84ZB+d6WU3iVa7Lc4 Fq2iyS0wvA8t6hS/dFPBpWtlT57w2aduO0x9+WP6SHf6g2Z7rKa82KYrbrG0+EvdSoFsRavqs1U QSVfFi3r2jxD34dPZOGpSaXgdpK8iGpZ36q44v0zpRahQhCLpbPYd2Q0F1jP61DJgZ3gkP8lu9h zYoNyiKGcZfYJ9wDVlQUVU68BnOmmdkzeTQvEZRw4+rTIO98qyt6aTwMtpn4e9jsIgV2HmXcPMJ cyJBb8N6ow+HXDXqRkZDhWPLkqzK3iMyI= X-Received: by 2002:a05:7022:327:b0:11b:9386:a38b with SMTP id a92af1059eb24-126f48e1fd4mr680897c88.46.1770165858753; Tue, 03 Feb 2026 16:44:18 -0800 (PST) Received: from medusa.lab.kspace.sh ([208.88.152.253]) by smtp.googlemail.com with UTF8SMTPSA id a92af1059eb24-126f503087esm833774c88.12.2026.02.03.16.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Feb 2026 16:44:18 -0800 (PST) Date: Tue, 3 Feb 2026 16:44:17 -0800 From: Mohamed Khalfella To: Hannes Reinecke Cc: Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , Christoph Hellwig , Jens Axboe , Keith Busch , Sagi Grimberg , Aaron Dailey , Randy Jennings , Dhaval Giani , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 03/14] nvmet: Implement CCR nvme command Message-ID: <20260204004417.GK3729-mkhalfella@purestorage.com> References: <20260130223531.2478849-1-mkhalfella@purestorage.com> <20260130223531.2478849-4-mkhalfella@purestorage.com> <77a00fa1-5707-4859-8a7a-e823ca18c9fe@suse.de> <20260203184039.GB3729-mkhalfella@purestorage.com> <21be273b-b1b2-4813-8178-e01cb0aa6301@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <21be273b-b1b2-4813-8178-e01cb0aa6301@suse.de> On Wed 2026-02-04 01:38:44 +0100, Hannes Reinecke wrote: > On 2/3/26 19:40, Mohamed Khalfella wrote: > > On Tue 2026-02-03 04:19:50 +0100, Hannes Reinecke wrote: > >> On 1/30/26 23:34, Mohamed Khalfella wrote: > >>> @@ -1501,6 +1516,38 @@ struct nvmet_ctrl *nvmet_ctrl_find_get(const char *subsysnqn, > >>> return ctrl; > >>> } > >>> > >>> +struct nvmet_ctrl *nvmet_ctrl_find_get_ccr(struct nvmet_subsys *subsys, > >>> + const char *hostnqn, u8 ciu, > >>> + u16 cntlid, u64 cirn) > >>> +{ > >>> + struct nvmet_ctrl *ctrl; > >>> + bool found = false; > >>> + > >>> + mutex_lock(&subsys->lock); > >>> + list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) { > >>> + if (ctrl->cntlid != cntlid) > >>> + continue; > >>> + if (strncmp(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE)) > >>> + continue; > >>> + > >> Why do we compare the hostnqn here, too? To my understanding the host > >> NQN is tied to the controller, so the controller ID should be sufficient > >> here. > > > > We got cntlid from CCR nvme command and we do not trust the value sent by > > the host. We check hostnqn to confirm that host is actually connected to > > the impacted controller. A host should not be allowed to reset a > > controller connected to another host. > > > Errm. So we're starting to not trust values in NVMe commands? > That is a very slippery road. > Ultimately it would require us to validate the cntlid on each > admin command. Which we don't. > And really there is no difference between CCR and any other > admin command; you get even worse effects if you would assume > a misdirected 'FORMAT' command. > > Please don't. Security is _not_ a concern here. I do not think the check hurts. If you say it is wrong I will delete it. > > Cheers, > > Hannes > -- > Dr. Hannes Reinecke Kernel Storage Architect > hare@suse.de +49 911 74053 688 > SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg > HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich