]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
afs: use kvfree() to free memory allocated by kvcalloc()
authorZilin Guan <zilin@seu.edu.cn>
Mon, 22 Jun 2026 09:08:41 +0000 (10:08 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 1 Jul 2026 13:26:19 +0000 (15:26 +0200)
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@seu.edu.cn>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/20260622090856.2746629-8-dhowells@redhat.com
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/afs/fs_operation.c

index c0dbbc6d3716e0b76f4e06870611b462d6091f04..20801b29521d1e2245a0a280384658b6dbf384d0 100644 (file)
@@ -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) {