[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <158404901390.1220563.13542240512778767032.stgit@warthog.procyon.org.uk>
Date: Thu, 12 Mar 2020 21:36:53 +0000
From: David Howells <dhowells@...hat.com>
To: torvalds@...ux-foundation.org
Cc: Jann Horn <jannh@...gle.com>, dhowells@...hat.com,
linux-afs@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] afs: Use kfree_rcu() instead of casting kfree() to
rcu_callback_t
From: Jann Horn <jannh@...gle.com>
afs_put_addrlist() casts kfree() to rcu_callback_t. Apart from being wrong
in theory, this might also blow up when people start enforcing function
types via compiler instrumentation, and it means the rcu_head has to be
first in struct afs_addr_list.
Use kfree_rcu() instead, it's simpler and more correct.
Signed-off-by: Jann Horn <jannh@...gle.com>
Signed-off-by: David Howells <dhowells@...hat.com>
---
fs/afs/addr_list.c | 2 +-
fs/afs/internal.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/afs/addr_list.c b/fs/afs/addr_list.c
index df415c05939e..de1ae0bead3b 100644
--- a/fs/afs/addr_list.c
+++ b/fs/afs/addr_list.c
@@ -19,7 +19,7 @@
void afs_put_addrlist(struct afs_addr_list *alist)
{
if (alist && refcount_dec_and_test(&alist->usage))
- call_rcu(&alist->rcu, (rcu_callback_t)kfree);
+ kfree_rcu(alist, rcu);
}
/*
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 1d81fc4c3058..35f951ac296f 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -81,7 +81,7 @@ enum afs_call_state {
* List of server addresses.
*/
struct afs_addr_list {
- struct rcu_head rcu; /* Must be first */
+ struct rcu_head rcu;
refcount_t usage;
u32 version; /* Version */
unsigned char max_addrs;
Powered by blists - more mailing lists