From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhenyu Wang Subject: Re: [PATCH] drm/i915/gvt: fix memory leak in intel_vgpu_ioctl() Date: Fri, 3 Aug 2018 09:27:15 +0800 Message-ID: <20180803012715.GB3035@zhen-hp.sh.intel.com> References: <1533256879-10220-1-git-send-email-wang.yi59@zte.com.cn> Reply-To: Zhenyu Wang Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0438256313==" Return-path: In-Reply-To: <1533256879-10220-1-git-send-email-wang.yi59@zte.com.cn> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Yi Wang 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 List-Id: dri-devel@lists.freedesktop.org --===============0438256313== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="p4qYPpj5QlsIQJ0K" Content-Disposition: inline --p4qYPpj5QlsIQJ0K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Yi Wang > Reviewed-by: Jiang Biao > --- 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(+) >=20 > 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 *md= ev, unsigned int cmd, > return ret; > break; > default: > + kfree(sparse); > return -EINVAL; > } > } > @@ -1215,6 +1216,7 @@ static long intel_vgpu_ioctl(struct mdev_device *md= ev, unsigned int cmd, > sizeof(info), caps.buf, > caps.size)) { > kfree(caps.buf); > + kfree(sparse); > return -EFAULT; > } > info.cap_offset =3D sizeof(info); > @@ -1223,6 +1225,7 @@ static long intel_vgpu_ioctl(struct mdev_device *md= ev, unsigned int cmd, > kfree(caps.buf); > } > =20 > + kfree(sparse); > return copy_to_user((void __user *)arg, &info, minsz) ? > -EFAULT : 0; > } else if (cmd =3D=3D VFIO_DEVICE_GET_IRQ_INFO) { > --=20 > 1.8.3.1 >=20 --=20 Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827 --p4qYPpj5QlsIQJ0K Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTXuabgHDW6LPt9CICxBBozTXgYJwUCW2OvcwAKCRCxBBozTXgY J2hFAKCT6/4vyk8ccIjt3kxtrY5uYpKnJACghGDMTrpFL0cw2KzVbwwPk6dDfkc= =WZ0c -----END PGP SIGNATURE----- --p4qYPpj5QlsIQJ0K-- --===============0438256313== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============0438256313==--