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: <Za5QoCO_o0duPJ4J@matsya>
Date: Mon, 22 Jan 2024 16:55:20 +0530
From: Vinod Koul <vkoul@...nel.org>
To: Kunwu Chan <chentao@...inos.cn>
Cc: dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmaengine: Add a null pointer check to the
 dma_request_chan

On 18-01-24, 11:30, Kunwu Chan wrote:
> kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure. Ensure the allocation was successful
> by checking the pointer validity.
> 
> Signed-off-by: Kunwu Chan <chentao@...inos.cn>
> ---
>  drivers/dma/dmaengine.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 491b22240221..a6f808d13aa4 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -856,6 +856,8 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
>  #ifdef CONFIG_DEBUG_FS
>  	chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev),
>  					  name);
> +	if (!chan->dbg_client_name)
> +		return chan;

That is wrong, you cant return a half done channel here
Pls see rest of the code for reference

>  #endif
>  
>  	chan->name = kasprintf(GFP_KERNEL, "dma:%s", name);
> -- 
> 2.39.2

-- 
~Vinod

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ