mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: Zheng Wang <zyytlz.wz@163.com>, nouveau@lists.freedesktop.org
Cc: bskeggs@redhat.com, kherbst@redhat.com, airlied@gmail.com,
	hackerzheng666@gmail.com, alex000young@gmail.com,
	security@kernel.org, daniel@ffwll.ch, Julia.Lawall@inria.fr,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/nouveau/mmu: fix use-after-free bug in nvkm_vmm_pfn_map
Date: Mon, 06 Mar 2023 19:11:18 -0500	[thread overview]
Message-ID: <5882bd80983ac04a32676f07622cba7d0e245e55.camel@redhat.com> (raw)
In-Reply-To: <20221029074654.203153-1-zyytlz.wz@163.com>

Actually - could you resend this with dri-devel@lists.freedesktop.org added to
the cc list just to make patchwork happy?

On Sat, 2022-10-29 at 15:46 +0800, Zheng Wang wrote:
> If it failed in kzalloc, vma will be freed in nvkm_vmm_node_merge.
> The later use of vma will casue use after free.
> 
> Reported-by: Zheng Wang <hackerzheng666@gmail.com>
> Reported-by: Zhuorao Yang <alex000young@gmail.com>
> 
> Fix it by returning to upper caller as soon as error occurs.
> 
> Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> index ae793f400ba1..04befd28f80b 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> @@ -1272,8 +1272,7 @@ nvkm_vmm_pfn_map(struct nvkm_vmm *vmm, u8 shift, u64 addr, u64 size, u64 *pfn)
>  						       page -
>  						       vmm->func->page, map);
>  			if (WARN_ON(!tmp)) {
> -				ret = -ENOMEM;
> -				goto next;
> +				return -ENOMEM;
>  			}
>  
>  			if ((tmp->mapped = map))

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


  parent reply	other threads:[~2023-03-07  0:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29  7:46 Zheng Wang
2022-11-02 10:35 ` Zheng Hacker
2023-03-07  0:04 ` Lyude Paul
2023-03-07  0:11 ` Lyude Paul [this message]
2023-03-07  4:24   ` 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=5882bd80983ac04a32676f07622cba7d0e245e55.camel@redhat.com \
    --to=lyude@redhat.com \
    --cc=Julia.Lawall@inria.fr \
    --cc=airlied@gmail.com \
    --cc=alex000young@gmail.com \
    --cc=bskeggs@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=hackerzheng666@gmail.com \
    --cc=kherbst@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=security@kernel.org \
    --cc=zyytlz.wz@163.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

all inboxes | Powered by JetHome®