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: <20180228154041.GK5453@intel.com>
Date:   Wed, 28 Feb 2018 17:40:41 +0200
From:   Ville Syrjälä <ville.syrjala@...ux.intel.com>
To:     Liviu Dudau <Liviu.Dudau@....com>
Cc:     DRI-devel <dri-devel@...ts.freedesktop.org>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel.vetter@...ll.ch>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/drm_ioctl.c: Test client capability value early when
 setting.

On Wed, Feb 28, 2018 at 03:27:41PM +0000, Liviu Dudau wrote:
> The drm_setclientcap() function implementing the DRM_IOCTL_SET_CLIENT_CAP
> ioctl expects that any capability set by the client will have a value of 1.
> Make the check early so that we don't have to test the value for each
> capability.

What if we want a a non-boolean capability at some point?

> 
> Signed-off-by: Liviu Dudau <liviu.dudau@....com>
> ---
>  drivers/gpu/drm/drm_ioctl.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index af782911c505..02ffa0e8d77b 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -306,22 +306,19 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
>  {
>  	struct drm_set_client_cap *req = data;
>  
> +	if (req->value > 1)
> +		return -EINVAL;
> +
>  	switch (req->capability) {
>  	case DRM_CLIENT_CAP_STEREO_3D:
> -		if (req->value > 1)
> -			return -EINVAL;
>  		file_priv->stereo_allowed = req->value;
>  		break;
>  	case DRM_CLIENT_CAP_UNIVERSAL_PLANES:
> -		if (req->value > 1)
> -			return -EINVAL;
>  		file_priv->universal_planes = req->value;
>  		break;
>  	case DRM_CLIENT_CAP_ATOMIC:
>  		if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
>  			return -EINVAL;
> -		if (req->value > 1)
> -			return -EINVAL;
>  		file_priv->atomic = req->value;
>  		file_priv->universal_planes = req->value;
>  		break;
> -- 
> 2.16.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ