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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <540027B5.5070704@samsung.com>
Date:	Fri, 29 Aug 2014 16:11:49 +0900
From:	Joonyoung Shim <jy0922.shim@...sung.com>
To:	Andrzej Hajda <a.hajda@...sung.com>,
	Inki Dae <inki.dae@...sung.com>
Cc:	Marek Szyprowski <m.szyprowski@...sung.com>,
	Seung-Woo Kim <sw0312.kim@...sung.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	dri-devel@...ts.freedesktop.org,
	open list <linux-kernel@...r.kernel.org>,
	"moderated list:ARM/S5P EXYNOS AR..." 
	<linux-samsung-soc@...r.kernel.org>,
	Joonyoung Shim <jy0922.shim@...sung.com>
Subject: Re: [PATCH v2 17/17] drm/exynos/ipp: add file checks for ioctls

Hi Andrzej,

On 08/28/2014 06:07 PM, Andrzej Hajda wrote:
> Process should not have access to ipp nodes created by another
> process. The patch adds necessary checks.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@...sung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_ipp.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> index fc8bb67..d233cfc 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> @@ -318,7 +318,8 @@ static void ipp_print_property(struct drm_exynos_ipp_property *property,
>  		sz->hsize, sz->vsize, config->flip, config->degree);
>  }
>  
> -static int ipp_find_and_set_property(struct drm_exynos_ipp_property *property)
> +static int ipp_find_and_set_property(struct drm_exynos_ipp_property *property,
> +		struct drm_file *file)

This is ok, but i think ipp_find_and_set_property function is some
duplicated. If we add function to get c_node from struct
exynos_drm_ippdrv, it's easy to remove ipp_find_and_set_property.

Thanks.

>  {
>  	struct exynos_drm_ippdrv *ippdrv;
>  	struct drm_exynos_ipp_cmd_node *c_node;
> @@ -339,8 +340,12 @@ static int ipp_find_and_set_property(struct drm_exynos_ipp_property *property)
>  	 */
>  	mutex_lock(&ippdrv->cmd_lock);
>  	list_for_each_entry(c_node, &ippdrv->cmd_list, list) {
> -		if ((c_node->property.prop_id == prop_id) &&
> -		    (c_node->state == IPP_STATE_STOP)) {
> +		if (c_node->property.prop_id == prop_id) {
> +			if (c_node->filp != file)
> +				break;
> +			if (c_node->state != IPP_STATE_STOP)
> +				break;
> +
>  			mutex_unlock(&ippdrv->cmd_lock);
>  			DRM_DEBUG_KMS("found cmd[%d]ippdrv[0x%x]\n",
>  				property->cmd, (int)ippdrv);
> @@ -418,7 +423,7 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data,
>  	 */
>  	if (property->prop_id) {
>  		DRM_DEBUG_KMS("prop_id[%d]\n", property->prop_id);
> -		return ipp_find_and_set_property(property);
> +		return ipp_find_and_set_property(property, file);
>  	}
>  
>  	/* find ipp driver using ipp id */
> @@ -1032,7 +1037,7 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data,
>  
>  	c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock,
>  		cmd_ctrl->prop_id);
> -	if (!c_node) {
> +	if (!c_node || c_node->filp != file) {
>  		DRM_ERROR("invalid command node list.\n");
>  		return -ENODEV;
>  	}
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ