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] [day] [month] [year] [list]
Message-ID: <298927114c054dfaca41e94520470a4c9430e6e8.camel@mediatek.com>
Date:   Mon, 25 Sep 2023 09:40:23 +0000
From:   CK Hu (胡俊光) <ck.hu@...iatek.com>
To:     "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "hmazur@...omium.org" <hmazur@...omium.org>
CC:     "mikrawczyk@...gle.com" <mikrawczyk@...gle.com>,
        Bibby Hsieh (謝濟遠) 
        <Bibby.Hsieh@...iatek.com>,
        "chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>,
        "djkurtz@...omium.org" <djkurtz@...omium.org>,
        "upstream@...ihalf.com" <upstream@...ihalf.com>,
        "daniel@...ll.ch" <daniel@...ll.ch>,
        "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
        "airlied@...il.com" <airlied@...il.com>,
        YT Shen (沈岳霆) <Yt.Shen@...iatek.com>,
        "matthias.bgg@...il.com" <matthias.bgg@...il.com>,
        "angelogioacchino.delregno@...labora.com" 
        <angelogioacchino.delregno@...labora.com>
Subject: Re: [PATCH] drm/mediatek: Check GEM buffer size

Hi, Hubert:

On Mon, 2023-09-25 at 09:22 +0000, Hubert Mazur wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  The buffer size is derived from parameters supplied by the
> userspace.
> Having the size equal 0 causes allocation failure leading to kernel
> panic.

The size is calculated by width and height, and drm_mode_create_dumb()
has checked the width and height, so the size would not be 0. So this
patch is redundant.

Regards,
CK

> 
> Fix this by checking if size equals 0.
> 
> Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC
> MT8173.")
> 
> Signed-off-by: Hubert Mazur <hmazur@...omium.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index 9f364df52478..3b985b99d5c6 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -62,6 +62,11 @@ struct mtk_drm_gem_obj *mtk_drm_gem_create(struct
> drm_device *dev,
>  	struct drm_gem_object *obj;
>  	int ret;
>  
> +	if (size == 0) {
> +		DRM_ERROR("Invalid allocation size: %zu", size);
> +		return ERR_PTR(-EINVAL);
> +	}
> +
>  	mtk_gem = mtk_drm_gem_init(dev, size);
>  	if (IS_ERR(mtk_gem))
>  		return ERR_CAST(mtk_gem);
> -- 
> 2.42.0.515.g380fc7ccd1-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ