All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: Yi Wang <wang.yi59@zte.com.cn>
Cc: zhenyuw@linux.intel.com, zhi.a.wang@intel.com,
	jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
	rodrigo.vivi@intel.com, airlied@linux.ie,
	intel-gvt-dev@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, jiang.biao2@zte.com.cn,
	zhong.weidong@zte.com.cn
Subject: Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
Date: Fri, 3 Aug 2018 09:27:15 +0800	[thread overview]
Message-ID: <20180803012715.GB3035@zhen-hp.sh.intel.com> (raw)
In-Reply-To: <1533256879-10220-1-git-send-email-wang.yi59@zte.com.cn>

[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]

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@zte.com.cn>
> Reviewed-by: Jiang Biao <jiang.biao2@zte.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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: Yi Wang <wang.yi59@zte.com.cn>
Cc: zhong.weidong@zte.com.cn, dri-devel@lists.freedesktop.org,
	airlied@linux.ie, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, rodrigo.vivi@intel.com,
	jiang.biao2@zte.com.cn, intel-gvt-dev@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
Date: Fri, 3 Aug 2018 09:27:15 +0800	[thread overview]
Message-ID: <20180803012715.GB3035@zhen-hp.sh.intel.com> (raw)
In-Reply-To: <1533256879-10220-1-git-send-email-wang.yi59@zte.com.cn>


[-- Attachment #1.1: Type: text/plain, Size: 1537 bytes --]

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@zte.com.cn>
> Reviewed-by: Jiang Biao <jiang.biao2@zte.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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-08-03  1:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03  0:41 [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() Yi Wang
2018-08-03  1:27 ` Zhenyu Wang [this message]
2018-08-03  1:27   ` Zhenyu Wang
2018-08-03 17:50 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-08-03 19:08 ` ✓ Fi.CI.IGT: " Patchwork
2018-08-08  7:23 ` [PATCH] " Zhenyu Wang
2018-08-08  7:23   ` Zhenyu Wang
2018-08-08 14:49   ` wang.yi59
2018-08-08  7:40 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() (rev2) Patchwork
2018-08-08  7:56 ` ✓ Fi.CI.BAT: success " Patchwork
2018-08-08  9:07 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180803012715.GB3035@zhen-hp.sh.intel.com \
    --to=zhenyuw@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jiang.biao2@zte.com.cn \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=wang.yi59@zte.com.cn \
    --cc=zhi.a.wang@intel.com \
    --cc=zhong.weidong@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.