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]
Date:   Tue, 20 Nov 2018 17:24:16 +0000
From:   Radhey Shyam Pandey <radheys@...inx.com>
To:     Andrea Merello <andrea.merello@...il.com>,
        "vkoul@...nel.org" <vkoul@...nel.org>,
        "dan.j.williams@...el.com" <dan.j.williams@...el.com>,
        "dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] dmaengine: fix dmaengine_desc_callback_valid() doesn't
 check for callback_result

> -----Original Message-----
> From: Andrea Merello <andrea.merello@...il.com>
> Sent: Friday, November 16, 2018 7:26 PM
> To: vkoul@...nel.org; dan.j.williams@...el.com; dmaengine@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org; Radhey Shyam Pandey
> <radheys@...inx.com>; Andrea Merello <andrea.merello@...il.com>
> Subject: [PATCH] dmaengine: fix dmaengine_desc_callback_valid() doesn't
> check for callback_result
> 
> There are two flavors of DMA completion callbacks: callback() and
> callback_result(); the latter takes an additional parameter that carries
> result information.
> 
> Most dmaengine helper functions that work with callbacks take care of both
> flavors i.e. dmaengine_desc_get_callback_invoke() first checks for
> callback_result() to be not NULL, and eventually it calls this one;
> otherwise it goes on checking for callback().
> 
> It seems however that dmaengine_desc_callback_valid() does not care about
> callback_result(), and it returns false in case callback() is NULL but
> callback_result() is not; unless there is a (hidden to me) reason for doing
> so then I'd say this is wrong.
> 
> I've hit this by using a DMA controller driver (xilinx_dma) that doesn't
> trigger any callback invocation unless dmaengine_desc_callback_valid()
> returns true, while I had only callback_result() implemented in my client
> driver (which AFAICT is always fine since dmaengine documentation says that
> callback() will be deprecated).

Thanks for the patch. In xilinx_dma driver call to _desc_callback_valid
can be safely removed as callback ptrs are anyway checked in invoke().
There is no much benefit in having redundant checks.

Related to dmaengine_desc_callback_valid extension will let Vinod comment.

> 
> This patch fixes this by making dmaengine_desc_callback_valid() to return
> true in the said scenario.
> 
> Signed-off-by: Andrea Merello <andrea.merello@...il.com>
> ---
>  drivers/dma/dmaengine.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h
> index 501c0b063f85..0ba2c1f3c55d 100644
> --- a/drivers/dma/dmaengine.h
> +++ b/drivers/dma/dmaengine.h
> @@ -168,7 +168,7 @@ dmaengine_desc_get_callback_invoke(struct
> dma_async_tx_descriptor *tx,
>  static inline bool
>  dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb)
>  {
> -	return (cb->callback) ? true : false;
> +	return (cb->callback || cb->callback_result);
>  }
> 
>  #endif
> --
> 2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ