lx_emul: add kvfree_call_rcu

Fixes #5089
This commit is contained in:
Christian Prochaska 2024-01-09 14:53:30 +01:00 committed by Christian Helmuth
parent 27c9825bf0
commit 3062b7d780
6 changed files with 23 additions and 45 deletions

View File

@ -65,18 +65,6 @@ int register_pernet_device(struct pernet_operations *ops)
}
#include <linux/rcutree.h>
/*
* taken from src/lib/wifi/lx_emul.c
*/
void kvfree_call_rcu(struct rcu_head * head, rcu_callback_t func)
{
void *ptr = (void *) head - (unsigned long) func;
kvfree(ptr);
}
#include <linux/gfp.h>
unsigned long get_zeroed_page(gfp_t gfp_mask)

View File

@ -67,3 +67,26 @@ void call_rcu(struct rcu_head * head,
func(head);
}
void kvfree_call_rcu(struct rcu_head * head, rcu_callback_t func)
{
void *ptr;
if (head) {
ptr = (void *) head - (unsigned long) func;
} else {
/*
* (original Linux comment)
*
* Please note there is a limitation for the head-less
* variant, that is why there is a clear rule for such
* objects: it can be used from might_sleep() context
* only. For other places please embed an rcu_head to
* your data.
*/
might_sleep();
ptr = (unsigned long *) func;
}
kvfree(ptr);
}

View File

@ -514,13 +514,6 @@ void rfkill_init(void)
}
void kvfree_call_rcu(struct rcu_head * head,rcu_callback_t func)
{
void *ptr = (void *) head - (unsigned long) func;
kvfree(ptr);
}
#include <linux/dma-mapping.h>
void *dmam_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,

View File

@ -219,16 +219,6 @@ void intel_vgpu_detect(struct drm_i915_private * dev_priv)
}
/*
* taken from src/lib/wifi/lx_emul.c
*/
void kvfree_call_rcu(struct rcu_head * head,rcu_callback_t func)
{
void *ptr = (void *) head - (unsigned long) func;
kvfree(ptr);
}
#include <linux/dma-mapping.h>
size_t dma_max_mapping_size(struct device * dev)

View File

@ -508,14 +508,6 @@ int kobject_synth_uevent(struct kobject * kobj,const char * buf,size_t count)
}
#include <linux/rcutree.h>
void kvfree_call_rcu(struct rcu_head * head,rcu_callback_t func)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/netdevice.h>
struct pernet_operations __net_initdata loopback_net_ops;

View File

@ -511,14 +511,6 @@ int kobject_synth_uevent(struct kobject * kobj,const char * buf,size_t count)
}
#include <linux/rcutree.h>
void kvfree_call_rcu(struct rcu_head * head,rcu_callback_t func)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/netdevice.h>
struct pernet_operations __net_initdata loopback_net_ops;