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: <6f08683083e113ea31b331288a50f4f2ac5e26b9.camel@sipsolutions.net>
Date: Mon, 25 Aug 2025 10:52:47 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Miaoqian Lin <linmq006@...il.com>, Richard Weinberger <richard@....at>, 
 Anton Ivanov <anton.ivanov@...bridgegreys.com>, Benjamin Berg
 <benjamin.berg@...el.com>, Tiwei Bie	 <tiwei.btw@...group.com>,
 linux-um@...ts.infradead.org, 	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] um: virtio_uml: Fix use-after-free after put_device in
 probe

On Mon, 2025-08-04 at 11:59 +0400, Miaoqian Lin wrote:
> When register_virtio_device() fails in virtio_uml_probe(),
> the code sets vu_dev->registered = 1 even though
> the device was not successfully registered.
> This can lead to use-after-free or other issues.
> 
> Fixes: 04e5b1fb0183 ("um: virtio: Remove device on disconnect")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
>  arch/um/drivers/virtio_uml.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c
> index ad8d78fb1d9a..c402c4cc908a 100644
> --- a/arch/um/drivers/virtio_uml.c
> +++ b/arch/um/drivers/virtio_uml.c
> @@ -1250,8 +1250,10 @@ static int virtio_uml_probe(struct platform_device *pdev)
>  	device_set_wakeup_capable(&vu_dev->vdev.dev, true);
>  
>  	rc = register_virtio_device(&vu_dev->vdev);
> -	if (rc)
> +	if (rc) {
>  		put_device(&vu_dev->vdev.dev);
> +		return rc;
> +	}
>  	vu_dev->registered = 1;
>  	return rc;
> 
This should now statically 'return 0' at the end.

johannes

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ