Commit 586a6377 authored by Ingo Molnar's avatar Ingo Molnar Committed by Thomas Gleixner

net: plug a few races

MUST-FIX: check the skbuff.c bit!
MUST-FIX: check the sched.c bit!

This doesn't look good. You declare it as a PER_CPU_LOCKED, but then
never use the extra lock to synchronize data.

Given that sock_proc_inuse_get() is a racy read anyway, the 'right' fix
would be to do something like:
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5f6b01fb
...@@ -395,7 +395,7 @@ static void skb_release_head_state(struct sk_buff *skb) ...@@ -395,7 +395,7 @@ static void skb_release_head_state(struct sk_buff *skb)
secpath_put(skb->sp); secpath_put(skb->sp);
#endif #endif
if (skb->destructor) { if (skb->destructor) {
WARN_ON(in_irq()); // WARN_ON(in_irq());
skb->destructor(skb); skb->destructor(skb);
} }
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
......
...@@ -2080,8 +2080,9 @@ static DECLARE_BITMAP(proto_inuse_idx, PROTO_INUSE_NR); ...@@ -2080,8 +2080,9 @@ static DECLARE_BITMAP(proto_inuse_idx, PROTO_INUSE_NR);
#ifdef CONFIG_NET_NS #ifdef CONFIG_NET_NS
void sock_prot_inuse_add(struct net *net, struct proto *prot, int val) void sock_prot_inuse_add(struct net *net, struct proto *prot, int val)
{ {
int cpu = smp_processor_id(); int cpu = get_cpu();
per_cpu_ptr(net->core.inuse, cpu)->val[prot->inuse_idx] += val; per_cpu_ptr(net->core.inuse, cpu)->val[prot->inuse_idx] += val;
put_cpu();
} }
EXPORT_SYMBOL_GPL(sock_prot_inuse_add); EXPORT_SYMBOL_GPL(sock_prot_inuse_add);
...@@ -2127,7 +2128,9 @@ static DEFINE_PER_CPU(struct prot_inuse, prot_inuse); ...@@ -2127,7 +2128,9 @@ static DEFINE_PER_CPU(struct prot_inuse, prot_inuse);
void sock_prot_inuse_add(struct net *net, struct proto *prot, int val) void sock_prot_inuse_add(struct net *net, struct proto *prot, int val)
{ {
__get_cpu_var(prot_inuse).val[prot->inuse_idx] += val; int cpu = get_cpu();
per_cpu(prot_inuse, cpu).val[prot->inuse_idx] += val;
put_cpu();
} }
EXPORT_SYMBOL_GPL(sock_prot_inuse_add); EXPORT_SYMBOL_GPL(sock_prot_inuse_add);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment