kernel_optimize_test/net/core
David Barroso b560f03ddf neigh: Explicitly declare RCU-bh read side critical section in neigh_xmit()
neigh_xmit() expects to be called inside an RCU-bh read side critical
section, and while one of its two current callers gets this right, the
other one doesn't.

More specifically, neigh_xmit() has two callers, mpls_forward() and
mpls_output(), and while both callers call neigh_xmit() under
rcu_read_lock(), this provides sufficient protection for neigh_xmit()
only in the case of mpls_forward(), as that is always called from
softirq context and therefore doesn't need explicit BH protection,
while mpls_output() can be called from process context with softirqs
enabled.

When mpls_output() is called from process context, with softirqs
enabled, we can be preempted by a softirq at any time, and RCU-bh
considers the completion of a softirq as signaling the end of any
pending read-side critical sections, so if we do get a softirq
while we are in the part of neigh_xmit() that expects to be run inside
an RCU-bh read side critical section, we can end up with an unexpected
RCU grace period running right in the middle of that critical section,
making things go boom.

This patch fixes this impedance mismatch in the callee, by making
neigh_xmit() always take rcu_read_{,un}lock_bh() around the code that
expects to be treated as an RCU-bh read side critical section, as this
seems a safer option than fixing it in the callers.

Fixes: 4fd3d7d9e8 ("neigh: Add helper function neigh_xmit")
Signed-off-by: David Barroso <dbarroso@fastly.com>
Signed-off-by: Lennert Buytenhek <lbuytenhek@fastly.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
Acked-by: Robert Shearman <rshearma@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-29 07:58:28 -04:00
..
datagram.c
dev_addr_lists.c
dev_ioctl.c
dev.c net: also make sch_handle_egress() drop monitor ready 2016-05-16 14:02:44 -04:00
devlink.c
drop_monitor.c
dst_cache.c
dst.c
ethtool.c net: define gso types for IPx over IPv4 and IPv6 2016-05-20 18:03:15 -04:00
fib_rules.c
filter.c bpf: fix matching of data/data_end in verifier 2016-06-15 23:37:54 -07:00
flow_dissector.c
flow.c
gen_estimator.c
gen_stats.c net_sched: add missing paddattr description 2016-06-08 11:17:39 -07:00
hwbm.c net: hwbm: Fix unbalanced spinlock in error case 2016-05-25 12:35:09 -07:00
link_watch.c
lwtunnel.c
Makefile
neighbour.c neigh: Explicitly declare RCU-bh read side critical section in neigh_xmit() 2016-06-29 07:58:28 -04:00
net_namespace.c
net-procfs.c
net-sysfs.c net-sysfs: fix missing <linux/of_net.h> 2016-06-08 00:37:58 -07:00
net-sysfs.h
net-traces.c
netclassid_cgroup.c
netevent.c
netpoll.c
netprio_cgroup.c
pktgen.c net: pktgen: Call destroy_hrtimer_on_stack() 2016-05-31 11:44:08 -07:00
ptp_classifier.c
request_sock.c
rtnetlink.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-05-09 15:59:24 -04:00
scm.c
secure_seq.c
skbuff.c skbuff: remove unused variable `doff' 2016-05-10 16:05:12 -04:00
sock_diag.c
sock_reuseport.c
sock.c
stream.c
sysctl_net_core.c bpf: add generic constant blinding for use in jits 2016-05-16 13:49:32 -04:00
timestamping.c
tso.c
utils.c