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] [thread-next>] [day] [month] [year] [list]
Message-ID: <c198586d-ab68-63f5-99fc-39401ee20cad@metafoo.de>
Date:   Sun, 24 Jun 2018 09:57:45 +0200
From:   Lars-Peter Clausen <lars@...afoo.de>
To:     Matthew Wilcox <willy@...radead.org>, linux-kernel@...r.kernel.org
Cc:     Dan Williams <dan.j.williams@...el.com>,
        Vinod Koul <vkoul@...nel.org>, dmaengine@...r.kernel.org
Subject: Re: [PATCH 16/26] dmaengine: Convert to new IDA API

On 06/21/2018 11:28 PM, Matthew Wilcox wrote:
> Simpler and shorter code.
> 
> Signed-off-by: Matthew Wilcox <willy@...radead.org>
> ---
[...]>  {
> -	int rc;
> -
> -	do {
> -		if (!ida_pre_get(&dma_ida, GFP_KERNEL))
> -			return -ENOMEM;
> -		mutex_lock(&dma_list_mutex);
> -		rc = ida_get_new(&dma_ida, &device->dev_id);
> -		mutex_unlock(&dma_list_mutex);
> -	} while (rc == -EAGAIN);
> +	int rc = ida_alloc(&dma_ida, GFP_KERNEL);
>  
> +	if (rc >= 0)
> +		device->dev_id = rc;
>  	return rc;

This used to return 0 on success, now it returns the ID. That wont work
considering that it is used like this

    rc = get_dma_id(device);
    if (rc != 0) ...


>  }
>  
> @@ -1090,9 +1082,7 @@ int dma_async_device_register(struct dma_device *device)
>  err_out:
>  	/* if we never registered a channel just release the idr */
>  	if (atomic_read(idr_ref) == 0) {
> -		mutex_lock(&dma_list_mutex);
> -		ida_remove(&dma_ida, device->dev_id);
> -		mutex_unlock(&dma_list_mutex);
> +		ida_free(&dma_ida, device->dev_id);
>  		kfree(idr_ref);
>  		return rc;
>  	}
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ