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: <20190430135809.5mgf4govbqj3cxph@valkosipuli.retiisi.org.uk>
Date:   Tue, 30 Apr 2019 16:58:09 +0300
From:   Sakari Ailus <sakari.ailus@....fi>
To:     Janusz Krzysztofik <jmkrzyszt@...il.com>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Hans Verkuil <hans.verkuil@...co.com>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org
Subject: Re: [PATCH 03/14] media: ov6650: Fix unverified arguments used in
 .set_fmt()

Hi Janusz,

On Mon, Apr 08, 2019 at 11:42:31PM +0200, Janusz Krzysztofik wrote:
> Commit 717fd5b4907ad ("[media] v4l2: replace try_mbus_fmt by set_fmt")
> converted a former ov6650_try_fmt() video operation callback to an
> ov6650_set_fmt() pad operation callback.  However, the function does not
> verify correctness of user provided format->which flag and pad config
> pointer arguments.  Fix it.
> 
> Fixes: 717fd5b4907ad ("[media] v4l2: replace try_mbus_fmt by set_fmt")
> Signed-off-by: Janusz Krzysztofik <jmkrzyszt@...il.com>
> Cc: stable@...r.kernel.org
> ---
>  drivers/media/i2c/ov6650.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
> index 007f0ca24913..3062c9a6c57b 100644
> --- a/drivers/media/i2c/ov6650.c
> +++ b/drivers/media/i2c/ov6650.c
> @@ -679,6 +679,17 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd,
>  	if (format->pad)
>  		return -EINVAL;
>  
> +	switch (format->which) {
> +	case V4L2_SUBDEV_FORMAT_ACTIVE:
> +		break;
> +	case V4L2_SUBDEV_FORMAT_TRY:
> +		if (cfg)
> +			break;
> +		/* fall through */
> +	default:
> +		return -EINVAL;
> +	}

For this to return an error, there would need to be a problem on the
caller's side. In other words, this isn't supposed to happen.

Instead of adding such checks to all drivers, I think they instead should
be added to the caller's side. The checks already exist for uAPI, but not
for other drivers.

The same applies to patches until 7th (including).

> +
>  	if (is_unscaled_ok(mf->width, mf->height, &priv->rect))
>  		v4l_bound_align_image(&mf->width, 2, W_CIF, 1,
>  				&mf->height, 2, H_CIF, 1, 0);

-- 
Kind regards,

Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ