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>] [day] [month] [year] [list]
Message-Id: <20211216021823.281472-1-jiasheng@iscas.ac.cn>
Date:   Thu, 16 Dec 2021 10:18:23 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     bskeggs@...hat.com, airlied@...ux.ie, daniel@...ll.ch
Cc:     dri-devel@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] drm/nouveau/acr: potential dereference of null pointer

The return value of kmalloc() needs to be checked.
To avoid use in memcpy() in case of the failure of alloc.

Fixes: 22dcda45a3d1 ("drm/nouveau/acr: implement new subdev to replace "secure boot"")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
index 667fa016496e..776573e77988 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
@@ -143,6 +143,9 @@ nvkm_acr_hsfw_load_bl(struct nvkm_acr *acr, const char *name, int ver,
 	hsfw->imem_size = desc->code_size;
 	hsfw->imem_tag = desc->start_tag;
 	hsfw->imem = kmalloc(desc->code_size, GFP_KERNEL);
+	if (!hsfw->imem)
+		return -ENOMEM;
+
 	memcpy(hsfw->imem, data + desc->code_off, desc->code_size);
 
 	nvkm_firmware_put(fw);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ