lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230112071842.819123-1-korantwork@gmail.com>
Date:   Thu, 12 Jan 2023 15:18:42 +0800
From:   korantwork@...il.com
To:     bskeggs@...hat.com, kherbst@...hat.com, airlied@...il.com,
        daniel@...ll.ch
Cc:     linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        nouveau@...ts.freedesktop.org, Xinghui Li <korantli@...cent.com>,
        loydlv <loydlv@...cent.com>
Subject: [PATCH] drm/nouveau/mmu: Fix an UAF issue in NVKM

From: Xinghui Li <korantli@...cent.com>

In nvkm_mem_new_host, the mem is be alloced. And mem->memory is
assigned to pmemory. During this process, the mem will be free if
the error occurs. But the *pmemory still points to the &mem->memory
which has been relased.Laterly, the nvkm_memory_unref will put the
memory which points to the pmemory again.So, we set the *pmemory to
NULL to avoid UAF issue.

Reported-by: loydlv <loydlv@...cent.com>
Signed-off-by: Xinghui Li <korantli@...cent.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c
index 92e363dbbc5a..ab30eb1fc0a3 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c
@@ -185,6 +185,7 @@ nvkm_mem_new_host(struct nvkm_mmu *mmu, int type, u8 page, u64 size,
 	} else
 	if ( (ret = nvif_unvers(ret, &argv, &argc, args->vn))) {
 		kfree(mem);
+		*pmemory = NULL;
 		return ret;
 	}
 
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ