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: <26a4651e-b56c-4350-8f9a-e0e2a2a3b452@stanley.mountain>
Date: Wed, 5 Mar 2025 18:00:32 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: David Howells <dhowells@...hat.com>
Cc: Marc Dionne <marc.dionne@...istor.com>, linux-afs@...ts.infradead.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH next] afs: Fix error code in afs_alloc_cell()

Return the error code if idr_alloc_cyclic() fails.  Currently it
potentially could return either -ENOMEM or an uninitialized variable.

Fixes: 72c52e46a517 ("afs: Change dynroot to create contents on demand")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
 fs/afs/cell.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 9f6b7718836c..dc56b0203b53 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -200,8 +200,10 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
 	atomic_inc(&net->cells_outstanding);
 	cell->dynroot_ino = idr_alloc_cyclic(&net->cells_dyn_ino, cell,
 					     2, INT_MAX / 2, GFP_KERNEL);
-	if ((int)cell->dynroot_ino < 0)
+	if ((int)cell->dynroot_ino < 0) {
+		ret = cell->dynroot_ino;
 		goto error;
+	}
 	cell->debug_id = atomic_inc_return(&cell_debug_id);
 
 	trace_afs_cell(cell->debug_id, 1, 0, afs_cell_trace_alloc);
-- 
2.47.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ