lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241218071949.GA25990@lst.de>
Date: Wed, 18 Dec 2024 08:19:49 +0100
From: Christoph Hellwig <hch@....de>
To: Leo Stone <leocstone@...il.com>
Cc: syzbot+ff4aab278fa7e27e0f9e@...kaller.appspotmail.com, hch@....de,
	sagi@...mberg.me, kch@...dia.com, linux-kernel@...r.kernel.org,
	syzkaller-bugs@...glegroups.com, linux-nvme@...ts.infradead.org
Subject: Re: [PATCH] nvmet: Don't overflow subsysnqn

On Tue, Dec 17, 2024 at 04:59:10PM -0800, Leo Stone wrote:
> 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 kstrdup instead of using the old buffer.
> 
> Reported-by: syzbot+ff4aab278fa7e27e0f9e@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=ff4aab278fa7e27e0f9e
> Fixes: 95409e277d83 ("nvmet: implement unique discovery NQN")
> Signed-off-by: Leo Stone <leocstone@...il.com>
> ---
>  drivers/nvme/target/configfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
> index eeee9e9b854c..3fa25f9f7d92 100644
> --- a/drivers/nvme/target/configfs.c
> +++ b/drivers/nvme/target/configfs.c
> @@ -2271,8 +2271,8 @@ static ssize_t nvmet_root_discovery_nqn_store(struct config_item *item,
>  			return -EINVAL;
>  		}
>  	}
> -	memset(nvmet_disc_subsys->subsysnqn, 0, NVMF_NQN_FIELD_LEN);
> -	memcpy(nvmet_disc_subsys->subsysnqn, page, len);
> +	kfree(nvmet_disc_subsys->subsysnqn);
> +	nvmet_disc_subsys->subsysnqn = kstrdup(page, GFP_KERNEL);

This needs error handling, pobably best done by using a local
variable for the new allocation, which would also help to keep it
outside the lock.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ