Skip to content

net: openvswitch: fix upcall counter access before allocation

Eelco Chaudron requested to merge echaudron/centos-stream-9:dev/bz2203263 into main

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2203263 Upstream Status: Backport net-next.git commit de9df6c6b27e Conflicts: none

Backport of upstream commit:

commit de9df6c6b27e22d7bdd20107947ef3a20e687de5 Author: Eelco Chaudron echaudro@redhat.com Date: Tue Jun 6 13:56:35 2023 +0200

net: openvswitch: fix upcall counter access before allocation

Currently, the per cpu upcall counters are allocated after the vport is
created and inserted into the system. This could lead to the datapath
accessing the counters before they are allocated resulting in a kernel
Oops.

Here is an example:

  PID: 59693    TASK: ffff0005f4f51500  CPU: 0    COMMAND: "ovs-vswitchd"
   ...

  PID: 58682    TASK: ffff0005b2f0bf00  CPU: 0    COMMAND: "kworker/0:3"

We moved the per cpu upcall counter allocation to the existing vport
alloc and free functions to solve this.

Fixes: 95637d91fefd ("net: openvswitch: release vport resources on failure")
Fixes: 1933ea365aa7 ("net: openvswitch: Add support to count upcall packets")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Eelco Chaudron echaudro@redhat.com

Merge request reports