]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drop_monitor: prevent init path from scheduling on the wrong cpu
authorNeil Horman <nhorman@tuxdriver.com>
Tue, 1 May 2012 08:18:02 +0000 (08:18 +0000)
committerGuangyu Sun <guangyu.sun@oracle.com>
Mon, 8 Oct 2012 17:01:00 +0000 (10:01 -0700)
commitbeb2f23c73a71860697e44581298efa22873884a
tree98248d63546814b048c513789368316a5a42cd79
parent0aac013b39523669773afcdf0bd3d3d09c4a46f5
drop_monitor: prevent init path from scheduling on the wrong cpu

commit 4fdcfa12843bca38d0c9deff70c8720e4e8f515f upstream.

I just noticed after some recent updates, that the init path for the drop
monitor protocol has a minor error.  drop monitor maintains a per cpu structure,
that gets initalized from a single cpu.  Normally this is fine, as the protocol
isn't in use yet, but I recently made a change that causes a failed skb
allocation to reschedule itself .  Given the current code, the implication is
that this workqueue reschedule will take place on the wrong cpu.  If drop
monitor is used early during the boot process, its possible that two cpus will
access a single per-cpu structure in parallel, possibly leading to data
corruption.

This patch fixes the situation, by storing the cpu number that a given instance
of this per-cpu data should be accessed from.  In the case of a need for a
reschedule, the cpu stored in the struct is assigned the rescheule, rather than
the currently executing cpu

Tested successfully by myself.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: David Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
net/core/drop_monitor.c