Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp264751imm; Thu, 2 Aug 2018 18:36:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfpLHypA1eU+LgQIM0yChGFPJNQ3WMMs8H3fU7LVY9WQvNO+lwuo2tAfl4334k67VyEfQNK X-Received: by 2002:a62:25c5:: with SMTP id l188-v6mr1994747pfl.179.1533260215250; Thu, 02 Aug 2018 18:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533260215; cv=none; d=google.com; s=arc-20160816; b=JFcGZr/irOImlMdKGhNGu2mYoD9c9Siq7M9RsoJPCiVMjKuk7lu92Ql2hYvnlbk14L RzgohjL7lIl1p6mGs05bviaHmV6H+hhyDKOkkn1L4Djg+hZC3ZHSoiTZYdrBC4xGvp3W s72ruU0/RkM6txZCIk2DrZjbqMIUt7ZvtgkfxuKMUffdbrGF1SLbvuOa/egf/OCsDFbL fHlDwl7qT9OH1HcDwXcfQfco1WNF59OnSopN7/mN/KIi6VHeeWffq4hxqpnwtzgZNfcN 34PO8TLUMpBUUOiizNa68R4STdbrLeAi66m3vTvd7gbSx+QwfEobH+h5aVuYy/tCO+5Z BhMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:arc-authentication-results; bh=2WgRm2Scp04TYC3aHtLQi36OhEULho/hWaje33B0Qqo=; b=x+0P0i+lrImyppFjIUvYZBi3UeIjmq2SWAWxlykffxoX7+tn0wKZfoRIXcNeOOFTZ1 seM8pdxrGr7FP9rOPSVUF+9C2DLym4+3ovXqqqU587GG0mL5Werb13Y9FhZ04bvqb8Ml e3vJpGenigu6rCjxoqocsMuNN+etGuONz//QPb6hNLsm43++VS3KL+cKpv2pJUa6K3Fr 3vG/UnRqU3mUGzXcyz4n9To7eC65iPmhSD93IFohzsHmkUqnJM3MfCz7nL0Z/l9j0nQa njLVItCA/kNd29KKhOHj9u9ZB4uYvKQjMe1LmW9Zclrr4mkxl9VAMzItp22ZQa7Hk6ec kpCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11-v6si3147868pli.86.2018.08.02.18.36.38; Thu, 02 Aug 2018 18:36:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732138AbeHCD3g (ORCPT + 99 others); Thu, 2 Aug 2018 23:29:36 -0400 Received: from mga07.intel.com ([134.134.136.100]:54759 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731899AbeHCD3g (ORCPT ); Thu, 2 Aug 2018 23:29:36 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2018 18:35:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,437,1526367600"; d="asc'?scan'208";a="72164885" Received: from zhen-hp.sh.intel.com (HELO zhen-hp) ([10.239.13.143]) by orsmga003.jf.intel.com with ESMTP; 02 Aug 2018 18:35:41 -0700 Date: Fri, 3 Aug 2018 09:27:15 +0800 From: Zhenyu Wang To: Yi Wang 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() Message-ID: <20180803012715.GB3035@zhen-hp.sh.intel.com> Reply-To: Zhenyu Wang References: <1533256879-10220-1-git-send-email-wang.yi59@zte.com.cn> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="p4qYPpj5QlsIQJ0K" Content-Disposition: inline In-Reply-To: <1533256879-10220-1-git-send-email-wang.yi59@zte.com.cn> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --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--