[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251105021658.1803652-1-zilin@seu.edu.cn>
Date: Wed, 5 Nov 2025 02:16:58 +0000
From: Zilin Guan <zilin@....edu.cn>
To: dhowells@...hat.com
Cc: marc.dionne@...istor.com,
linux-afs@...ts.infradead.org,
linux-kernel@...r.kernel.org,
jianhao.xu@....edu.cn,
Zilin Guan <zilin@....edu.cn>
Subject: [PATCH] afs: use kvfree() to free memory allocated by kvcalloc()
op->more_files is allocated with kvcalloc() but released via
afs_put_operation(), which uses kfree() internally. This mismach prevents
the resource from being released properly and may lead to undefined
behavior.
Fix this by using kvfree() to free op->more_files to match its allocation
method.
Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept")
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
fs/afs/fs_operation.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/afs/fs_operation.c b/fs/afs/fs_operation.c
index 8418813ee043..ae0c9750c6b6 100644
--- a/fs/afs/fs_operation.c
+++ b/fs/afs/fs_operation.c
@@ -348,7 +348,7 @@ int afs_put_operation(struct afs_operation *op)
for (i = 0; i < op->nr_files - 2; i++)
if (op->more_files[i].put_vnode)
iput(&op->more_files[i].vnode->netfs.inode);
- kfree(op->more_files);
+ kvfree(op->more_files);
}
if (op->estate) {
--
2.34.1
Powered by blists - more mailing lists