mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Hannes Reinecke <hare@kernel.org>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Hannes Reinecke <hare@suse.de>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	Eric Biggers <ebiggers@kernel.org>,
	David Howells <dhowells@redhat.com>,
	Jarkko Sakkinen <jarkko@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>, Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	keyrings@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-hardening@vger.kernel.org,
	Martin Belanger <martin.nvme.dev@gmail.com>
Subject: Re: [PATCH v7 14/14] nvme-auth: allow to update pre-provisioned keys
Date: Fri, 27 Nov 2026 05:15:40 +0800	[thread overview]
Message-ID: <20261127044024.YlqHcQQx-lkp@intel.com> (raw)
In-Reply-To: <20261126-dhchap-keyring-v4-v7-14-ee438ffea527@kernel.org>

Hi Hannes,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 68099cf27253a8c89d703a282d3d811446d9453b]

url:    https://github.com/intel-lab-lkp/linux/commits/Hannes-Reinecke/nvme-auth-modify-nvme_auth_transform_key-to-return-status/20261126-151219
base:   68099cf27253a8c89d703a282d3d811446d9453b
patch link:    https://lore.kernel.org/r/20261126-dhchap-keyring-v4-v7-14-ee438ffea527%40kernel.org
patch subject: [PATCH v7 14/14] nvme-auth: allow to update pre-provisioned keys
config: hexagon-randconfig-1001-20261127 (https://download.01.org/0day-ci/archive/20261127/20261127044024.YlqHcQQx-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project fb29ca8163c3309160711e5a14eb46bc6d4fdad2)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261127/20261127044024.YlqHcQQx-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261127044024.YlqHcQQx-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/nvme/host/sysfs.c:891:17: warning: variable 'old_key' is uninitialized when used here [-Wuninitialized]
     891 |             key_serial(old_key) != key_serial(key)) {
         |                        ^~~~~~~
   drivers/nvme/host/sysfs.c:853:27: note: initialize the variable 'old_key' to silence this warning
     853 |         struct key *key, *old_key;
         |                                  ^
         |                                   = NULL
   drivers/nvme/host/sysfs.c:996:17: warning: variable 'old_key' is uninitialized when used here [-Wuninitialized]
     996 |             key_serial(old_key) != key_serial(key)) {
         |                        ^~~~~~~
   drivers/nvme/host/sysfs.c:959:27: note: initialize the variable 'old_key' to silence this warning
     959 |         struct key *key, *old_key;
         |                                  ^
         |                                   = NULL
   2 warnings generated.


vim +/old_key +891 drivers/nvme/host/sysfs.c

   848	
   849	static ssize_t dhchap_secret_store(struct device *dev,
   850			struct device_attribute *attr, const char *buf, size_t count)
   851	{
   852		struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
   853		struct key *key, *old_key;
   854		char *dhchap_secret;
   855		bool generated = false;
   856		size_t len;
   857		int ret;
   858	
   859		if (!ctrl->host_key || !count)
   860			return -EINVAL;
   861	
   862		len = strcspn(buf, "\n");
   863		dhchap_secret = kzalloc(len + 1, GFP_KERNEL);
   864		if (!dhchap_secret)
   865			return -ENOMEM;
   866		memcpy(dhchap_secret, buf, len);
   867		nvme_auth_stop(ctrl);
   868	
   869		key = nvme_auth_extract_key(dhchap_secret, len,
   870					    &generated);
   871		if (IS_ERR(key)) {
   872			kfree_sensitive(dhchap_secret);
   873			return PTR_ERR(key);
   874		}
   875		down_read(&key->sem);
   876		ret = key_validate(key);
   877		up_read(&key->sem);
   878		if (ret) {
   879			dev_warn(ctrl->device, "key %08x invalidated\n",
   880				 key_serial(key));
   881			if (generated) {
   882				dev_dbg(ctrl->device, "revoke host key %08x\n",
   883					key_serial(key));
   884				key_revoke(key);
   885			}
   886			key_put(key);
   887			kfree_sensitive(dhchap_secret);
   888			return ret;
   889		}
   890		if (!generated &&
 > 891		    key_serial(old_key) != key_serial(key)) {
   892			dev_warn(ctrl->device, "cannot change pre-populated key %08x\n",
   893				 key_serial(old_key));
   894			key_put(key);
   895			kfree_sensitive(dhchap_secret);
   896			return -EPERM;
   897		}
   898		mutex_lock(&ctrl->dhchap_auth_mutex);
   899		old_key = ctrl->host_key;
   900		if (old_key && old_key == key) {
   901			dev_warn(ctrl->device, "using existing key %08x\n",
   902				 key_serial(old_key));
   903			old_key = key;
   904		} else {
   905			if (ctrl->host_key_generated) {
   906				dev_dbg(ctrl->device, "revoke host key %08x\n",
   907					key_serial(old_key));
   908				key_revoke(old_key);
   909			}
   910			ctrl->host_key = key;
   911			ctrl->host_key_generated = generated;
   912		}
   913		mutex_unlock(&ctrl->dhchap_auth_mutex);
   914		key_put(old_key);
   915		kfree_sensitive(dhchap_secret);
   916		/* Start re-authentication */
   917		dev_info(ctrl->device, "re-authenticating controller\n");
   918		queue_work(nvme_wq, &ctrl->dhchap_auth_work);
   919		flush_work(&ctrl->dhchap_auth_work);
   920		return count;
   921	}
   922	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2026-11-26 21:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 14:12 [PATCH v7 00/14] nvme-auth: switch to use the kernel keyring Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 01/14] nvme-auth: modify nvme_auth_transform_key() to return status Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 02/14] nvme-keyring: add 'dhchap' key type Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 03/14] nvme-keyring: drop nvme_tls_psk_revoked() Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 04/14] Documentation/security/keys: fixup function name Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 05/14] nvme-keyring: link addtional keyring into .nvme keyring Hannes Reinecke
2026-11-26 19:49   ` kernel test robot
2026-11-26 20:22   ` kernel test robot
2026-11-26 14:12 ` [PATCH v7 06/14] nvme-auth: switch to use 'struct key' Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 07/14] nvme: parse dhchap keys during option parsing Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 08/14] nvmet-auth: parse dhchap key from configfs attribute Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 09/14] nvme: allow to pass in key description as dhchap secret Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 10/14] nvme-auth: allow to specify the key by key serial Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 11/14] nvme-auth: wait for authentication to finish when changing keys Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 12/14] nvme-fabrics: allow to pass in keyring by name Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 13/14] nvme-auth: link pre-provisioned keys into .nvme keyring Hannes Reinecke
2026-11-26 14:12 ` [PATCH v7 14/14] nvme-auth: allow to update pre-provisioned keys Hannes Reinecke
2026-11-26 21:15   ` kernel test robot [this message]
2026-11-26 16:00 ` [PATCH v7 00/14] nvme-auth: switch to use the kernel keyring Jarkko Sakkinen
2026-11-26 16:03   ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127044024.YlqHcQQx-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=axboe@kernel.dk \
    --cc=corbet@lwn.net \
    --cc=dhowells@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=gustavoars@kernel.org \
    --cc=hare@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jarkko@kernel.org \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=kees@kernel.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=martin.nvme.dev@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=rdunlap@infradead.org \
    --cc=sagi@grimberg.me \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®