mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
afs: Use kfree_rcu() instead of casting kfree() to rcu_callback_t
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@google.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
0d81a3f29c
commit
ddd2b85ff7
@@ -19,7 +19,7 @@
|
|||||||
void afs_put_addrlist(struct afs_addr_list *alist)
|
void afs_put_addrlist(struct afs_addr_list *alist)
|
||||||
{
|
{
|
||||||
if (alist && refcount_dec_and_test(&alist->usage))
|
if (alist && refcount_dec_and_test(&alist->usage))
|
||||||
call_rcu(&alist->rcu, (rcu_callback_t)kfree);
|
kfree_rcu(alist, rcu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -81,7 +81,7 @@ enum afs_call_state {
|
|||||||
* List of server addresses.
|
* List of server addresses.
|
||||||
*/
|
*/
|
||||||
struct afs_addr_list {
|
struct afs_addr_list {
|
||||||
struct rcu_head rcu; /* Must be first */
|
struct rcu_head rcu;
|
||||||
refcount_t usage;
|
refcount_t usage;
|
||||||
u32 version; /* Version */
|
u32 version; /* Version */
|
||||||
unsigned char max_addrs;
|
unsigned char max_addrs;
|
||||||
|
Reference in New Issue
Block a user