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:   Thu, 2 Dec 2021 12:31:47 +0000
From:   Daniel Scally <djrscally@...il.com>
To:     Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc:     linuxarm@...wei.com, mauro.chehab@...wei.com,
        Bingbu Cao <bingbu.cao@...el.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Tianshu Qiu <tian.shu.qiu@...el.com>,
        Yong Zhi <yong.zhi@...el.com>, linux-kernel@...r.kernel.org,
        linux-media@...r.kernel.org
Subject: Re: [PATCH] media: ipu3: don't use recursion at the Kernel

Hi Mauro

On 02/12/2021 11:44, Mauro Carvalho Chehab wrote:
> The Kernel stack is too small. Doing recursions there is a very
> bad idea, as, if something gets wrong, it could lead to data
> corruption.


TIL - I'll bear that in mind in the future, thanks.

> So, re-implement cio2_check_fwnode_graph() to avoid
> recursion.
>
> Compile-tested only.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>


FWIW:

Reviewed-by: Daniel Scally <djrscally@...il.com>

Tested-by: Daniel Scally <djrscally@...il.com>

> ---
>  drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
> index 356ea966cf8d..8e4f250a8b56 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
> @@ -1691,16 +1691,15 @@ static int cio2_check_fwnode_graph(struct fwnode_handle *fwnode)
>  {
>  	struct fwnode_handle *endpoint;
>  
> -	if (IS_ERR_OR_NULL(fwnode))
> -		return -EINVAL;
> -
> -	endpoint = fwnode_graph_get_next_endpoint(fwnode, NULL);
> -	if (endpoint) {
> -		fwnode_handle_put(endpoint);
> -		return 0;
> +	while (!IS_ERR_OR_NULL(fwnode)) {
> +		endpoint = fwnode_graph_get_next_endpoint(fwnode, NULL);
> +		if (endpoint) {
> +			fwnode_handle_put(endpoint);
> +			return 0;
> +		}
> +		fwnode = fwnode->secondary;
>  	}
> -
> -	return cio2_check_fwnode_graph(fwnode->secondary);
> +	return -EINVAL;
>  }
>  
>  /**************** PCI interface ****************/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ