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: <20190906075413.GE1586@valkosipuli.retiisi.org.uk>
Date:   Fri, 6 Sep 2019 10:54:13 +0300
From:   Sakari Ailus <sakari.ailus@....fi>
To:     Jan Kotas <jank@...ence.com>
Cc:     maxime.ripard@...tlin.com, mchehab@...nel.org, robh+dt@...nel.org,
        mark.rutland@....com, rafalc@...ence.com,
        linux-media@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] media: Add lane checks for Cadence CSI2RX

Hi Jan,

Thanks for the patchset.

On Thu, Sep 05, 2019 at 11:56:00AM +0100, Jan Kotas wrote:
> This patch adds lane checks for CSI2RX, to prevent clock lane
> being used as a data lane.
> 
> Signed-off-by: Jan Kotas <jank@...ence.com>
> ---
>  drivers/media/platform/cadence/cdns-csi2rx.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
> index 31ace114e..97ec09e72 100644
> --- a/drivers/media/platform/cadence/cdns-csi2rx.c
> +++ b/drivers/media/platform/cadence/cdns-csi2rx.c
> @@ -2,7 +2,7 @@
>  /*
>   * Driver for Cadence MIPI-CSI2 RX Controller v1.3
>   *
> - * Copyright (C) 2017 Cadence Design Systems Inc.
> + * Copyright (C) 2017-2019 Cadence Design Systems Inc.
>   */
>  
>  #include <linux/clk.h>
> @@ -364,7 +364,7 @@ static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx)
>  	struct v4l2_fwnode_endpoint v4l2_ep = { .bus_type = 0 };
>  	struct fwnode_handle *fwh;
>  	struct device_node *ep;
> -	int ret;
> +	int ret, i;
>  
>  	ep = of_graph_get_endpoint_by_regs(csi2rx->dev->of_node, 0, 0);
>  	if (!ep)
> @@ -395,6 +395,15 @@ static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx)
>  		return -EINVAL;
>  	}
>  
> +	for (i = 0; i < csi2rx->num_lanes; i++) {
> +		if (csi2rx->lanes[i] < 1) {

Do you need this? v4l2_fwnode_parse_endpoint() already has a more thorough
check for the lane numbers.

> +			dev_err(csi2rx->dev, "Invalid lane[%d] number: %u\n",
> +				i, csi2rx->lanes[i]);
> +			of_node_put(ep);
> +			return -EINVAL;
> +		}
> +	}
> +
>  	csi2rx->asd.match.fwnode = fwnode_graph_get_remote_port_parent(fwh);
>  	csi2rx->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
>  	of_node_put(ep);

-- 
Regards,

Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ