]> www.infradead.org Git - nvme.git/commit
nvmet: Don't overflow subsysnqn
authorLeo Stone <leocstone@gmail.com>
Wed, 18 Dec 2024 18:49:57 +0000 (10:49 -0800)
committerKeith Busch <kbusch@kernel.org>
Fri, 27 Dec 2024 21:14:31 +0000 (13:14 -0800)
commit4db3d750ac7e894278ef1cb1c53cc7d883060496
tree7ae030332c8bcd82e2bf80a3a2af5956228b41e6
parentebefac5647968679f6ef5803e5d35a71997d20fa
nvmet: Don't overflow subsysnqn

nvmet_root_discovery_nqn_store treats the subsysnqn string like a fixed
size buffer, even though it is dynamically allocated to the size of the
string.

Create a new string with kstrndup instead of using the old buffer.

Reported-by: syzbot+ff4aab278fa7e27e0f9e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=ff4aab278fa7e27e0f9e
Fixes: 95409e277d83 ("nvmet: implement unique discovery NQN")
Signed-off-by: Leo Stone <leocstone@gmail.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/configfs.c