From: Greg KH <gregkh@linuxfoundation.org>
To: Zheng Hacker <hackerzheng666@gmail.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>,
"alex000young@gmail.com" <alex000young@gmail.com>,
"security@kernel.org" <security@kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"tvrtko.ursulin@linux.intel.com" <tvrtko.ursulin@linux.intel.com>,
"airlied@linux.ie" <airlied@linux.ie>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"joonas.lahtinen@linux.intel.com"
<joonas.lahtinen@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
xmzyshypnc <1002992920@qq.com>,
"jani.nikula@linux.intel.com" <jani.nikula@linux.intel.com>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"rodrigo.vivi@intel.com" <rodrigo.vivi@intel.com>,
"intel-gvt-dev@lists.freedesktop.org"
<intel-gvt-dev@lists.freedesktop.org>,
"zhi.a.wang@intel.com" <zhi.a.wang@intel.com>
Subject: Re: [PATCH] drm/i915/gvt: fix double-free bug in split_2MB_gtt_entry.
Date: Sat, 17 Sep 2022 11:08:23 +0200 [thread overview]
Message-ID: <YyWOh+jGvmSdrHqz@kroah.com> (raw)
In-Reply-To: <CAJedcCzt_1ZRV5egMLdoFVZ4hBDE+nDu9fLkBuGY0A=uYicvQA@mail.gmail.com>
On Fri, Sep 16, 2022 at 11:54:42PM +0800, Zheng Hacker wrote:
> >From afe79848cb74cc8e45ab426d13fa2394c87e0422 Mon Sep 17 00:00:00 2001
> From: xmzyshypnc <1002992920@qq.com>
> Date: Fri, 16 Sep 2022 23:48:23 +0800
> Subject: [PATCH] drm/i915/gvt: fix double-free bug in split_2MB_gtt_entry
>
> There is a double-free security bug in split_2MB_gtt_entry.
>
> Here is a calling chain :
> ppgtt_populate_spt->ppgtt_populate_shadow_entry->split_2MB_gtt_entry.
>
> If intel_gvt_dma_map_guest_page failed, it will call
> ppgtt_invalidate_spt, which will finally call ppgtt_free_spt and
> kfree(spt). But the caller does not notice that, and it will call
> ppgtt_free_spt again in error path.
>
> Fix this by only freeing spt in ppgtt_invalidate_spt in good case.
>
> Signed-off-by: Zheng Wang <hackerzheng666@gmail.com>
> ---
> drivers/gpu/drm/i915/gvt/gtt.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
> index ce0eb03709c3..550519f0acca 100644
> --- a/drivers/gpu/drm/i915/gvt/gtt.c
> +++ b/drivers/gpu/drm/i915/gvt/gtt.c
> @@ -959,7 +959,7 @@ static inline int ppgtt_put_spt(struct
> intel_vgpu_ppgtt_spt *spt)
> return atomic_dec_return(&spt->refcount);
> }
>
> -static int ppgtt_invalidate_spt(struct intel_vgpu_ppgtt_spt *spt);
> +static int ppgtt_invalidate_spt(struct intel_vgpu_ppgtt_spt *spt, int
> is_error);
>
> static int ppgtt_invalidate_spt_by_shadow_entry(struct intel_vgpu *vgpu,
> struct intel_gvt_gtt_entry *e)
> @@ -995,7 +995,7 @@ static int
> ppgtt_invalidate_spt_by_shadow_entry(struct intel_vgpu *vgpu,
Still line-wrapped and whitespace broken :(
next prev parent reply other threads:[~2022-09-17 9:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tencent_E1BBF05904DFB73C478DCD592740AAE0780A@qq.com>
[not found] ` <CAJedcCxVW++iH49UFZp9ruUuTcNubWCH6Wsqe11K4COB3E8msg@mail.gmail.com>
2022-09-05 7:35 ` [PATCH] drm/i915/gvt: fix double-free bug in split_2MB_gtt_entry Zheng Hacker
2022-09-05 7:46 ` Zheng Hacker
2022-09-05 8:04 ` Greg KH
2022-09-05 8:53 ` Alex Young
2022-09-06 11:36 ` Zheng Hacker
2022-09-07 3:07 ` Zhenyu Wang
2022-09-07 6:47 ` Zheng Hacker
2022-09-08 9:09 ` Zheng Hacker
2022-09-08 9:19 ` Greg KH
[not found] ` <CAJedcCwVC6Rg+wF7h6GhFvL6BGkKV=DS9Mo9fOf-gfDAk9VqPg@mail.gmail.com>
2022-09-16 6:39 ` Zheng Hacker
2022-09-16 6:40 ` Zheng Hacker
2022-09-16 8:25 ` Greg KH
2022-09-16 15:21 ` Zheng Hacker
2022-09-16 15:54 ` Zheng Hacker
2022-09-17 9:08 ` Greg KH [this message]
2022-09-18 17:17 ` Zheng Hacker
[not found] <tencent_ED24158E83CB9885E8BDD173EB5896B51906@qq.com>
2022-09-19 9:30 ` Jani Nikula
2022-09-19 9:55 ` Zheng Hacker
2022-09-21 9:13 ` Zheng Hacker
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=YyWOh+jGvmSdrHqz@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=1002992920@qq.com \
--cc=airlied@linux.ie \
--cc=alex000young@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hackerzheng666@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=security@kernel.org \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=zhenyuw@linux.intel.com \
--cc=zhi.a.wang@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox