]> git.baikalelectronics.ru Git - kernel.git/commit
net: openvswitch: fix to make sure flow_lookup() is not preempted
authorEelco Chaudron <echaudro@redhat.com>
Sat, 17 Oct 2020 18:24:51 +0000 (20:24 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sun, 18 Oct 2020 19:29:36 +0000 (12:29 -0700)
commit71ec3f7e71aa9978380d247a80145688c6e0bdf2
tree63f50c31fb06abe5ba190e3490ddec5c5cd59f2c
parent62d7c4da7fd61006c83fccfcbe1418bdba9eeb47
net: openvswitch: fix to make sure flow_lookup() is not preempted

The flow_lookup() function uses per CPU variables, which must be called
with BH disabled. However, this is fine in the general NAPI use case
where the local BH is disabled. But, it's also called from the netlink
context. The below patch makes sure that even in the netlink path, the
BH is disabled.

In addition, u64_stats_update_begin() requires a lock to ensure one writer
which is not ensured here. Making it per-CPU and disabling NAPI (softirq)
ensures that there is always only one writer.

Fixes: 9b86e35402e7 ("net: openvswitch: reorder masks array based on usage")
Reported-by: Juri Lelli <jlelli@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Link: https://lore.kernel.org/r/160295903253.7789.826736662555102345.stgit@ebuild
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/openvswitch/flow_table.c
net/openvswitch/flow_table.h