From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 385D0156C6A for ; Wed, 4 Feb 2026 00:55:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770166528; cv=none; b=P7Chpey/oeGJqKCHBCFJGHInEFj6jgCNwF7jVY35G9JGHl7dBpWO4XJBft+z/RacXUN4UkrdNWiUFV3c490Fv5xImcFq56Ian0bDRM5PY0ae5InZqViTL3RjRMovfGXESeRxo9VyrdAaqUGJ4sE4nC3ZUUaA0Syl6toH0EkL75c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770166528; c=relaxed/simple; bh=LOTzsMJVbhUQ30CsD+GsXveeAb54zKq5dzZlIYAqd2c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Kb5AEbsKytSl6nRWvbxKy9Cv7FTPnYvVwK7RmbEmibFiEWT6zrMzN9bQz8OBBkdtgnpbj1CSCvuCOLs45FNTrTN44US6pTWVgfzMBsfcYskseAcyM2bQz/XHR07aD8A89bYbOMdvwfG26jGFQp8EY385bOqAmeZfiGmKD3JpQuU= 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; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=n/kv9bYG; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=9G+MebsW; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=n/kv9bYG; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=9G+MebsW; arc=none smtp.client-ip=195.135.223.130 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="n/kv9bYG"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="9G+MebsW"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="n/kv9bYG"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="9G+MebsW" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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-out1.suse.de (Postfix) with ESMTPS id 6B0903E6D0; Wed, 4 Feb 2026 00:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1770166525; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K1Q8Pit9YQ/nF8VnotS4PFqLnPOmjxjJLChcDyHHRkE=; b=n/kv9bYGIICV/I77Acc2hiEfUHOc4Unpzdddi/Ji9HyZZzEuGCdZZD8xDPcsR2Qi3gTEF0 mSNRnqPdRluBYvDPHlSEFaaJf1SZTozKkYjLKTMANIrfnhvmmMaaWqxoktLcmuScFIHu1u QTSD5YMHyzmHHs/Q6GI0HGQlwmDqe9c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1770166525; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K1Q8Pit9YQ/nF8VnotS4PFqLnPOmjxjJLChcDyHHRkE=; b=9G+MebsWv6sHCKibgtANGzboSwGWWvV3nGbBh0KdZNbj0kw1pmSJtCHT7vFBnloEbOZWI5 Jtv8DBt/pxQUOSDw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1770166525; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K1Q8Pit9YQ/nF8VnotS4PFqLnPOmjxjJLChcDyHHRkE=; b=n/kv9bYGIICV/I77Acc2hiEfUHOc4Unpzdddi/Ji9HyZZzEuGCdZZD8xDPcsR2Qi3gTEF0 mSNRnqPdRluBYvDPHlSEFaaJf1SZTozKkYjLKTMANIrfnhvmmMaaWqxoktLcmuScFIHu1u QTSD5YMHyzmHHs/Q6GI0HGQlwmDqe9c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1770166525; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K1Q8Pit9YQ/nF8VnotS4PFqLnPOmjxjJLChcDyHHRkE=; b=9G+MebsWv6sHCKibgtANGzboSwGWWvV3nGbBh0KdZNbj0kw1pmSJtCHT7vFBnloEbOZWI5 Jtv8DBt/pxQUOSDw== Received: from imap1.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BA39F3EA63; Wed, 4 Feb 2026 00:55:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id HTIEHfiYgmkjcgAAD6G6ig (envelope-from ); Wed, 04 Feb 2026 00:55:20 +0000 Message-ID: Date: Wed, 4 Feb 2026 01:55:18 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 03/14] nvmet: Implement CCR nvme command To: Mohamed Khalfella 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 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> <20260204004417.GK3729-mkhalfella@purestorage.com> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20260204004417.GK3729-mkhalfella@purestorage.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -4.30 X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[14]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[broadcom.com,gmail.com,nvidia.com,lst.de,kernel.dk,kernel.org,grimberg.me,purestorage.com,lists.infradead.org,vger.kernel.org]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Level: X-Spam-Flag: NO On 2/4/26 01:44, Mohamed Khalfella wrote: > 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. > It's not 'wrong', It's inconsistent. The argument that the contents of an admin command may be wrong applies to _every_ admin command. Yet we never check on any of those commands. So I fail to see why this command requires special treatment. 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