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: <BYAPR21MB1688B317E2ECB18E709502D8D750A@BYAPR21MB1688.namprd21.prod.outlook.com>
Date:   Thu, 8 Jun 2023 15:15:53 +0000
From:   "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
To:     Jiasheng Jiang <jiasheng@...as.ac.cn>,
        KY Srinivasan <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        "wei.liu@...nel.org" <wei.liu@...nel.org>,
        Dexuan Cui <decui@...rosoft.com>,
        "nathan@...nel.org" <nathan@...nel.org>
CC:     "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] Drivers: hv: vmbus: Add missing check for dma_set_mask

From: Jiasheng Jiang <jiasheng@...as.ac.cn> Sent: Tuesday, June 6, 2023 6:43 PM
> 
> Add check for dma_set_mask() and return the error if it fails.
> 
> Fixes: 6bf625a4140f ("Drivers: hv: vmbus: Rework use of DMA_BIT_MASK(64)")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> ---
>  drivers/hv/vmbus_drv.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 1c65a6dfb9fa..68b7be2762ea 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -1908,7 +1908,11 @@ int vmbus_device_register(struct hv_device
> *child_device_obj)
> 
>  	child_device_obj->device.dma_parms = &child_device_obj->dma_parms;
>  	child_device_obj->device.dma_mask = &child_device_obj->dma_mask;
> -	dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64));
> +	ret = dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64));
> +	if (ret) {
> +		put_device(&child_device_obj->device);

I don't think the put_device() call is correct here.  The underlying kobj in
child_device_obj->device is not initialized until device_register() calls
device_initialize().  It's after device_initialize() is called that put_device()
must be used.

That said, I don't see that the memory for the child_device_obj gets
freed if we just do "return ret", though maybe I'm missing it.  And there's
the matter of the memory allocated by dev_set_name().   Getting this
error path fully correct may be rather awkward. :-(

Michael

> +		return ret;
> +	}
> 
>  	/*
>  	 * Register with the LDM. This will kick off the driver/device
> --
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ