[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180803012715.GB3035@zhen-hp.sh.intel.com>
Date: Fri, 3 Aug 2018 09:27:15 +0800
From: Zhenyu Wang <zhenyuw@...ux.intel.com>
To: Yi Wang <wang.yi59@....com.cn>
Cc: zhenyuw@...ux.intel.com, zhi.a.wang@...el.com,
jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
rodrigo.vivi@...el.com, airlied@...ux.ie,
intel-gvt-dev@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, jiang.biao2@....com.cn,
zhong.weidong@....com.cn
Subject: Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
On 2018.08.03 08:41:19 +0800, Yi Wang wrote:
> The 'sparse' variable may leak when return in function
> intel_vgpu_ioctl(), and this patch fixes this.
>
> Signed-off-by: Yi Wang <wang.yi59@....com.cn>
> Reviewed-by: Jiang Biao <jiang.biao2@....com.cn>
> ---
Looks fine to me, will queue this up.
Thanks for the patch!
> drivers/gpu/drm/i915/gvt/kvmgt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index df4e4a0..6a6f199 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -1200,6 +1200,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> return ret;
> break;
> default:
> + kfree(sparse);
> return -EINVAL;
> }
> }
> @@ -1215,6 +1216,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> sizeof(info), caps.buf,
> caps.size)) {
> kfree(caps.buf);
> + kfree(sparse);
> return -EFAULT;
> }
> info.cap_offset = sizeof(info);
> @@ -1223,6 +1225,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> kfree(caps.buf);
> }
>
> + kfree(sparse);
> return copy_to_user((void __user *)arg, &info, minsz) ?
> -EFAULT : 0;
> } else if (cmd == VFIO_DEVICE_GET_IRQ_INFO) {
> --
> 1.8.3.1
>
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists