]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
bpf: offload: ignore namespace moves
authorJakub Kicinski <jakub.kicinski@netronome.com>
Mon, 20 Nov 2017 23:21:57 +0000 (15:21 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 20 Nov 2017 23:37:35 +0000 (00:37 +0100)
We are currently destroying the device offload state when device
moves to another net namespace.  This doesn't break with current
NFP code, because offload state is not used on program removal,
but it's not correct behaviour.

Ignore the device unregister notifications on namespace move.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/offload.c

index a778e5df7e265a614621df83e6b144d2507b76c2..d4267c674fec1b1a08cee9f5f074b3eeb2767826 100644 (file)
@@ -174,6 +174,10 @@ static int bpf_offload_notification(struct notifier_block *notifier,
 
        switch (event) {
        case NETDEV_UNREGISTER:
+               /* ignore namespace changes */
+               if (netdev->reg_state != NETREG_UNREGISTERING)
+                       break;
+
                list_for_each_entry_safe(offload, tmp, &bpf_prog_offload_devs,
                                         offloads) {
                        if (offload->netdev == netdev)