[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4167140.1741187764@warthog.procyon.org.uk>
Date: Wed, 05 Mar 2025 15:16:04 +0000
From: David Howells <dhowells@...hat.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: dhowells@...hat.com, Marc Dionne <marc.dionne@...istor.com>,
linux-afs@...ts.infradead.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH next] afs: Fix error code in afs_alloc_cell()
Dan Carpenter <dan.carpenter@...aro.org> wrote:
> Return the error code if idr_alloc_cyclic() fails. Currently it
> potentially could return either -ENOMEM or an uninitialized variable.
Thanks, but Christian has already pulled an updated version into his tree. It
may not have made it into linux-next yet:
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -203,7 +203,13 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
cell->dns_status = vllist->status;
smp_store_release(&cell->dns_lookup_count, 1); /* vs source/status */
atomic_inc(&net->cells_outstanding);
+ ret = idr_alloc_cyclic(&net->cells_dyn_ino, cell,
+ 2, INT_MAX / 2, GFP_KERNEL);
+ if (ret < 0)
+ goto error;
+ cell->dynroot_ino = ret;
cell->debug_id = atomic_inc_return(&cell_debug_id);
+
trace_afs_cell(cell->debug_id, 1, 0, afs_cell_trace_alloc);
_leave(" = %p", cell);
David
Powered by blists - more mailing lists