All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
@ 2018-08-03  0:41 Yi Wang
  2018-08-03  1:27   ` Zhenyu Wang
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Yi Wang @ 2018-08-03  0:41 UTC (permalink / raw)
  To: zhenyuw
  Cc: zhi.a.wang, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
	intel-gvt-dev, intel-gfx, dri-devel, linux-kernel, jiang.biao2,
	wang.yi59, zhong.weidong

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>
---
 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
  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
  2018-08-03 17:50 ` ✓ Fi.CI.BAT: success for " Patchwork
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Zhenyu Wang @ 2018-08-03  1:27 UTC (permalink / raw)
  To: Yi Wang
  Cc: zhenyuw, zhi.a.wang, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	airlied, intel-gvt-dev, intel-gfx, dri-devel, linux-kernel,
	jiang.biao2, zhong.weidong

[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
@ 2018-08-03  1:27   ` Zhenyu Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Zhenyu Wang @ 2018-08-03  1:27 UTC (permalink / raw)
  To: Yi Wang
  Cc: zhong.weidong, dri-devel, airlied, intel-gfx, linux-kernel,
	rodrigo.vivi, jiang.biao2, intel-gvt-dev


[-- 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
  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
@ 2018-08-03 17:50 ` Patchwork
  2018-08-03 19:08 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2018-08-03 17:50 UTC (permalink / raw)
  To: Yi Wang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
URL   : https://patchwork.freedesktop.org/series/47685/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4613 -> Patchwork_9850 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/47685/revisions/1/mbox/

== Known issues ==

  Here are the changes found in Patchwork_9850 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_frontbuffer_tracking@basic:
      {fi-byt-clapper}:   PASS -> FAIL (fdo#103167)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_hangcheck:
      fi-skl-guc:         DMESG-FAIL (fdo#107174) -> PASS

    igt@drv_selftest@live_workarounds:
      fi-bdw-5557u:       DMESG-FAIL (fdo#107292) -> PASS
      fi-cnl-psr:         DMESG-FAIL (fdo#107292) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#107174 https://bugs.freedesktop.org/show_bug.cgi?id=107174
  fdo#107292 https://bugs.freedesktop.org/show_bug.cgi?id=107292


== Participating hosts (52 -> 47) ==

  Additional (1): fi-glk-j4005 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-gdg-551 


== Build changes ==

    * Linux: CI_DRM_4613 -> Patchwork_9850

  CI_DRM_4613: e3dd88c4ffdcda9f36bdb43cbdd7eaa605002055 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4587: 5d78c73d871525ec9caecd88ad7d9abe36637314 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9850: 71847e926b1b93f02ec89aeefc46950e777c898b @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

71847e926b1b drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9850/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
  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
  2018-08-03 17:50 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-08-03 19:08 ` Patchwork
  2018-08-08  7:23   ` Zhenyu Wang
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2018-08-03 19:08 UTC (permalink / raw)
  To: Yi Wang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
URL   : https://patchwork.freedesktop.org/series/47685/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4613_full -> Patchwork_9850_full =

== Summary - SUCCESS ==

  No regressions found.

  

== Known issues ==

  Here are the changes found in Patchwork_9850_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@shrink:
      shard-glk:          PASS -> FAIL (fdo#106886)

    igt@kms_setmode@basic:
      shard-kbl:          NOTRUN -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@gem_eio@reset-stress:
      shard-hsw:          FAIL -> PASS

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          INCOMPLETE (fdo#103665, fdo#106023) -> PASS

    
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * Linux: CI_DRM_4613 -> Patchwork_9850

  CI_DRM_4613: e3dd88c4ffdcda9f36bdb43cbdd7eaa605002055 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4587: 5d78c73d871525ec9caecd88ad7d9abe36637314 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9850: 71847e926b1b93f02ec89aeefc46950e777c898b @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9850/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
  2018-08-03  0:41 [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() Yi Wang
@ 2018-08-08  7:23   ` Zhenyu Wang
  2018-08-03 17:50 ` ✓ Fi.CI.BAT: success for " Patchwork
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Zhenyu Wang @ 2018-08-08  7:23 UTC (permalink / raw)
  To: Yi Wang
  Cc: zhi.a.wang, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
	intel-gvt-dev, intel-gfx, dri-devel, linux-kernel, jiang.biao2,
	zhong.weidong

[-- Attachment #1: Type: text/plain, Size: 2667 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>
> ---
>  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);

Unfortunately this would cause a double-free error in normal path, as we
tried to free sparse after use to add caps. So may be better to fix free
in error path and move normal free of sparse in final point, e.g

diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 68df9aa88890..47b897b6ea93 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1257,11 +1257,13 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
 					&sparse->header, sizeof(*sparse) +
 					(sparse->nr_areas *
 						sizeof(*sparse->areas)));
-				kfree(sparse);
-				if (ret)
+				if (ret) {
+					kfree(sparse);
 					return ret;
+				}
 				break;
 			default:
+				kfree(sparse);
 				return -EINVAL;
 			}
 		}
@@ -1277,6 +1279,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);
@@ -1285,6 +1288,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) {



-- 
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 --]

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
@ 2018-08-08  7:23   ` Zhenyu Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Zhenyu Wang @ 2018-08-08  7:23 UTC (permalink / raw)
  To: Yi Wang
  Cc: zhong.weidong, airlied, intel-gfx, linux-kernel, dri-devel,
	rodrigo.vivi, jiang.biao2, intel-gvt-dev, zhi.a.wang


[-- Attachment #1.1: Type: text/plain, Size: 2667 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>
> ---
>  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);

Unfortunately this would cause a double-free error in normal path, as we
tried to free sparse after use to add caps. So may be better to fix free
in error path and move normal free of sparse in final point, e.g

diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 68df9aa88890..47b897b6ea93 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1257,11 +1257,13 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
 					&sparse->header, sizeof(*sparse) +
 					(sparse->nr_areas *
 						sizeof(*sparse->areas)));
-				kfree(sparse);
-				if (ret)
+				if (ret) {
+					kfree(sparse);
 					return ret;
+				}
 				break;
 			default:
+				kfree(sparse);
 				return -EINVAL;
 			}
 		}
@@ -1277,6 +1279,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);
@@ -1285,6 +1288,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) {



-- 
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 --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() (rev2)
  2018-08-03  0:41 [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() Yi Wang
                   ` (3 preceding siblings ...)
  2018-08-08  7:23   ` Zhenyu Wang
@ 2018-08-08  7:40 ` Patchwork
  2018-08-08  7:56 ` ✓ Fi.CI.BAT: success " Patchwork
  2018-08-08  9:07 ` ✓ Fi.CI.IGT: " Patchwork
  6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2018-08-08  7:40 UTC (permalink / raw)
  To: Zhenyu Wang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() (rev2)
URL   : https://patchwork.freedesktop.org/series/47685/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
2d59c7433443 drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
-:16: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#16: 
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c

-:81: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)

total: 1 errors, 1 warnings, 0 checks, 29 lines checked

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() (rev2)
  2018-08-03  0:41 [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() Yi Wang
                   ` (4 preceding siblings ...)
  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 ` Patchwork
  2018-08-08  9:07 ` ✓ Fi.CI.IGT: " Patchwork
  6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2018-08-08  7:56 UTC (permalink / raw)
  To: Zhenyu Wang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() (rev2)
URL   : https://patchwork.freedesktop.org/series/47685/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4631 -> Patchwork_9878 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/47685/revisions/2/mbox/

== Known issues ==

  Here are the changes found in Patchwork_9878 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    {igt@amdgpu/amd_prime@amd-to-i915}:
      {fi-kbl-8809g}:     NOTRUN -> FAIL (fdo#107341)

    igt@drv_module_reload@basic-reload-inject:
      fi-hsw-4770r:       PASS -> DMESG-WARN (fdo#107425)

    igt@drv_selftest@live_workarounds:
      fi-skl-6700hq:      PASS -> DMESG-FAIL (fdo#107292)
      fi-cnl-psr:         PASS -> DMESG-FAIL (fdo#107292)
      fi-kbl-7560u:       PASS -> DMESG-FAIL (fdo#107292)

    
    ==== Possible fixes ====

    {igt@amdgpu/amd_basic@userptr}:
      {fi-kbl-8809g}:     INCOMPLETE (fdo#107402) -> PASS

    igt@drv_selftest@live_coherency:
      fi-gdg-551:         DMESG-FAIL (fdo#107164) -> PASS

    igt@drv_selftest@live_workarounds:
      fi-kbl-x1275:       DMESG-FAIL (fdo#107292) -> PASS

    
    ==== Warnings ====

    {igt@kms_psr@primary_page_flip}:
      fi-cnl-psr:         DMESG-WARN (fdo#107372) -> DMESG-FAIL (fdo#107372)

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
  fdo#107292 https://bugs.freedesktop.org/show_bug.cgi?id=107292
  fdo#107341 https://bugs.freedesktop.org/show_bug.cgi?id=107341
  fdo#107372 https://bugs.freedesktop.org/show_bug.cgi?id=107372
  fdo#107402 https://bugs.freedesktop.org/show_bug.cgi?id=107402
  fdo#107425 https://bugs.freedesktop.org/show_bug.cgi?id=107425


== Participating hosts (53 -> 48) ==

  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * Linux: CI_DRM_4631 -> Patchwork_9878

  CI_DRM_4631: cf4f0ad8aac757e06f83b2bf1346d7d4748895d6 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4587: 5d78c73d871525ec9caecd88ad7d9abe36637314 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9878: 2d59c74334437c0ff6506686d883353fe516c6d1 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

2d59c7433443 drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9878/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() (rev2)
  2018-08-03  0:41 [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() Yi Wang
                   ` (5 preceding siblings ...)
  2018-08-08  7:56 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-08-08  9:07 ` Patchwork
  6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2018-08-08  9:07 UTC (permalink / raw)
  To: Zhenyu Wang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() (rev2)
URL   : https://patchwork.freedesktop.org/series/47685/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4631_full -> Patchwork_9878_full =

== Summary - SUCCESS ==

  No regressions found.

  

== Known issues ==

  Here are the changes found in Patchwork_9878_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
      shard-snb:          NOTRUN -> INCOMPLETE (fdo#105411)

    igt@kms_setmode@basic:
      shard-kbl:          NOTRUN -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@drv_suspend@shrink:
      shard-kbl:          FAIL (fdo#106886) -> PASS

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          INCOMPLETE (fdo#103665, fdo#106023) -> PASS

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking-fencing:
      shard-glk:          FAIL (fdo#105703, fdo#107409) -> PASS

    igt@kms_cursor_crc@cursor-128x128-suspend:
      shard-glk:          FAIL (fdo#103375) -> PASS

    igt@kms_cursor_legacy@pipe-c-torture-bo:
      shard-glk:          DMESG-WARN (fdo#107122) -> PASS

    igt@kms_flip@flip-vs-expired-vblank:
      shard-glk:          FAIL (fdo#105363) -> PASS

    igt@perf_pmu@busy-accuracy-50-bcs0:
      shard-snb:          INCOMPLETE (fdo#105411) -> SKIP

    
  fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
  fdo#107122 https://bugs.freedesktop.org/show_bug.cgi?id=107122
  fdo#107409 https://bugs.freedesktop.org/show_bug.cgi?id=107409
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * Linux: CI_DRM_4631 -> Patchwork_9878

  CI_DRM_4631: cf4f0ad8aac757e06f83b2bf1346d7d4748895d6 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4587: 5d78c73d871525ec9caecd88ad7d9abe36637314 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9878: 2d59c74334437c0ff6506686d883353fe516c6d1 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9878/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl()
  2018-08-08  7:23   ` Zhenyu Wang
  (?)
@ 2018-08-08 14:49   ` wang.yi59
  -1 siblings, 0 replies; 11+ messages in thread
From: wang.yi59 @ 2018-08-08 14:49 UTC (permalink / raw)
  To: zhenyuw
  Cc: zhong.weidong, airlied, intel-gfx, linux-kernel, dri-devel,
	rodrigo.vivi, jiang.biao2, intel-gvt-dev


[-- Attachment #1.1: Type: text/plain, Size: 1758 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>
> > ---
> >  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);
>
> Unfortunately this would cause a double-free error in normal path, as we
> tried to free sparse after use to add caps. So may be better to fix free
> in error path and move normal free of sparse in final point, e.g

Yeah, that's right! Thanks a lot for your advice. I will send a v2 patch.


---
Best wishes
Yi Wang

[-- 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-08-08 14:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.