From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5491B377EA1 for ; Tue, 3 Mar 2026 19:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772564683; cv=none; b=Dx6gQcCYWCxH2WyYdMOOIRIwCbjfnsaEO2gByxdpnF9SU7rKGUOOSLTmbkCYMFd6xALNqqMPMdPeo8pNG94zEqLt1HUfITvqpDQKXnaDzQ3AD5BxYCQ5KzItf95pihgdzZWzJ4Lrirc1NOVV0KblwlsJHFsr6rAi2BBh+I5A1fQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772564683; c=relaxed/simple; bh=WhUagZ1UicyaFpNhua8urbyirAhseXZfR89wly+Nt6w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Km0MUK6cd6K+vXDx6GEJpNlhBB52+NNffhR2tBzygNi+Mw2Oz81mL8IWcCQl0GrdfCUYlJ8qelFk1+ufKg6LBWx8AsfC1ysFitsOgynV8vSKNLQZnEjrBZ5QCMg20T4FJ/8MEUDo5D1v2GJqEzl1V9ybNI7465QdzYxWU/0fC6c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=s1D4OrrT; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="s1D4OrrT" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772564680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+bYJxoGJiSgadF5JuKBSKfLsqU/3X+2Cl2fZ2lKuHEQ=; b=s1D4OrrTwU9i2oEBicHGxlYuSQO+Jqn+FHKbmV72z6ui6q6lUNfJSnS0xxf4eDvWBSRSCw +PtOWeLF8GH8ZC9WR65nngvkvlhMB8TxF3ZTFNinZGskWp0rYcEy43Dt1uRFf0YhRT2mPp I4h1loe8kIoa+w322SVLwy3jnUaIvpY= From: Thorsten Blum To: Hannes Reinecke , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Jens Axboe Cc: Thorsten Blum , stable@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] nvmet-auth: Don't log DHCHAP keys in nvmet_setup_auth() Date: Tue, 3 Mar 2026 20:03:50 +0100 Message-ID: <20260303190350.78705-4-thorsten.blum@linux.dev> In-Reply-To: <20260303190350.78705-2-thorsten.blum@linux.dev> References: <20260303190350.78705-2-thorsten.blum@linux.dev> 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-Migadu-Flow: FLOW_OUT When debug logging is enabled, nvmet_setup_auth() logs the host and controller DHCHAP key bytes. Remove the keys from debug logs to avoid exposing key material. Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum --- drivers/nvme/target/auth.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c index 2eadeb7e06f2..f24add0bb86f 100644 --- a/drivers/nvme/target/auth.c +++ b/drivers/nvme/target/auth.c @@ -199,10 +199,9 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq) ctrl->host_key = NULL; goto out_free_hash; } - pr_debug("%s: using hash %s key %*ph\n", __func__, + pr_debug("%s: using hash %s\n", __func__, ctrl->host_key->hash > 0 ? - nvme_auth_hmac_name(ctrl->host_key->hash) : "none", - (int)ctrl->host_key->len, ctrl->host_key->key); + nvme_auth_hmac_name(ctrl->host_key->hash) : "none"); nvme_auth_free_key(ctrl->ctrl_key); if (!host->dhchap_ctrl_secret) { @@ -217,10 +216,9 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq) ctrl->ctrl_key = NULL; goto out_free_hash; } - pr_debug("%s: using ctrl hash %s key %*ph\n", __func__, + pr_debug("%s: using ctrl hash %s\n", __func__, ctrl->ctrl_key->hash > 0 ? - nvme_auth_hmac_name(ctrl->ctrl_key->hash) : "none", - (int)ctrl->ctrl_key->len, ctrl->ctrl_key->key); + nvme_auth_hmac_name(ctrl->ctrl_key->hash) : "none"); out_free_hash: if (ret) { -- Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4