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: <20230208070559.19589-1-jiasheng@iscas.ac.cn>
Date:   Wed,  8 Feb 2023 15:05:59 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     ogabbay@...nel.org, arnd@...db.de, gregkh@...uxfoundation.org,
        ttayar@...ana.ai, dliberman@...ana.ai, obitton@...ana.ai,
        osharabi@...ana.ai, dhirschfeld@...ana.ai
Cc:     linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] habanalabs: Fix freeing uninitialized pointers

As the memory allocated by kcalloc has not been set to zero, it may
contain uninitialized pointers.
Therefore, free the non-NULL pointers may cause undefined behaviour.

Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/misc/habanalabs/common/device.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index 87ab329e65d4..dc6fcb9cca7a 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -901,9 +901,8 @@ static int device_early_init(struct hl_device *hdev)
 free_eq_wq:
 	destroy_workqueue(hdev->eq_wq);
 free_cq_wq:
-	for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++)
-		if (hdev->cq_wq[i])
-			destroy_workqueue(hdev->cq_wq[i]);
+	while (i--)
+		destroy_workqueue(hdev->cq_wq[i]);
 	kfree(hdev->cq_wq);
 asid_fini:
 	hl_asid_fini(hdev);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ