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: <20231022111537.878237-1-hi@alyssa.is>
Date:   Sun, 22 Oct 2023 11:15:37 +0000
From:   Alyssa Ross <hi@...ssa.is>
To:     Li Yang <leoyang.li@....com>
Cc:     linuxppc-dev@...ts.ozlabs.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Claudiu Manoil <claudiu.manoil@....com>,
        Roy Pledge <roy.pledge@....com>, Scott Wood <oss@...error.net>
Subject: [PATCH] soc: fsl: qbman: fix null pointer dereference

When called from bman_test_api(), bm_bpalloc may not have been
initialized by fsl_bman_probe(), in which case gen_pool_alloc() would
attempt to dereference a NULL pointer.

Checking that bm_bpalloc is non-NULL allows boot to continue is this
case.

Fixes: 97e0d385b139 ("soc/bman: Add self-test for BMan driver")
Signed-off-by: Alyssa Ross <hi@...ssa.is>
---
 drivers/soc/fsl/qbman/bman.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soc/fsl/qbman/bman.c b/drivers/soc/fsl/qbman/bman.c
index 6cc1847e534a..713a0508678e 100644
--- a/drivers/soc/fsl/qbman/bman.c
+++ b/drivers/soc/fsl/qbman/bman.c
@@ -669,6 +669,9 @@ static int bm_alloc_bpid_range(u32 *result, u32 count)
 {
 	unsigned long addr;
 
+	if (!bm_bpalloc)
+		return -ENXIO;
+
 	addr = gen_pool_alloc(bm_bpalloc, count);
 	if (!addr)
 		return -ENOMEM;

base-commit: 58720809f52779dc0f08e53e54b014209d13eebb
-- 
2.42.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ