]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
objtool, nvmet: Fix out-of-bounds stack access in nvmet_ctrl_state_show()
authorJosh Poimboeuf <jpoimboe@kernel.org>
Mon, 24 Mar 2025 21:56:05 +0000 (14:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:39:26 +0000 (14:39 +0200)
commit1adc93a525fdee8e2b311e6d5fd93eb69714ca05
treec6e620dfa43180065b879fc42550308f64c5ba50
parent456300be232e05ac847fc5a0bd8b04d7ded69041
objtool, nvmet: Fix out-of-bounds stack access in nvmet_ctrl_state_show()

[ Upstream commit 107a23185d990e3df6638d9a84c835f963fe30a6 ]

The csts_state_names[] array only has six sparse entries, but the
iteration code in nvmet_ctrl_state_show() iterates seven, resulting in a
potential out-of-bounds stack read.  Fix that.

Fixes the following warning with an UBSAN kernel:

  vmlinux.o: warning: objtool: .text.nvmet_ctrl_state_show: unexpected end of section

Fixes: 649fd41420a8 ("nvmet: add debugfs support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/f1f60858ee7a941863dc7f5506c540cb9f97b5f6.1742852847.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/oe-kbuild-all/202503171547.LlCTJLQL-lkp@intel.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/target/debugfs.c