Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tbogendoerfer@suse.de>2019-11-05 14:08:48 +0100
committerThomas Bogendoerfer <tbogendoerfer@suse.de>2019-11-05 14:10:09 +0100
commitccf9a995609f3ae9b9f259fd0d292e8ca4f4f6e1 (patch)
tree98e81305f05c602551b7c44b392fbce850ac0362
parent9b9474a43427bd98f3bcdfdbf22a5fafcd08a34a (diff)
net: fix installing orphaned programs (bsc#1154353).
-rw-r--r--patches.suse/net-fix-installing-orphaned-programs.patch46
-rw-r--r--series.conf1
2 files changed, 47 insertions, 0 deletions
diff --git a/patches.suse/net-fix-installing-orphaned-programs.patch b/patches.suse/net-fix-installing-orphaned-programs.patch
new file mode 100644
index 0000000000..2515c37f5b
--- /dev/null
+++ b/patches.suse/net-fix-installing-orphaned-programs.patch
@@ -0,0 +1,46 @@
+From: Jakub Kicinski <jakub.kicinski@netronome.com>
+Date: Thu, 31 Oct 2019 20:07:00 -0700
+Subject: net: fix installing orphaned programs
+Patch-mainline: v5.4-rc6
+Git-commit: aefc3e723a78c2e429a64dadd7815ef2a4aecd44
+References: bsc#1154353
+
+When netdevice with offloaded BPF programs is destroyed
+the programs are orphaned and removed from the program
+IDA - their IDs get released (the programs may remain
+accessible via existing open file descriptors and pinned
+files). After IDs are released they are set to 0.
+
+This confuses dev_change_xdp_fd() because it compares
+the __dev_xdp_query() result where 0 means no program
+with prog->aux->id where 0 means orphaned.
+
+dev_change_xdp_fd() would have incorrectly returned success
+even though it had not installed the program.
+
+Since drivers already catch this case via bpf_offload_dev_match()
+let them handle this case. The error message drivers produce in
+this case ("program loaded for a different device") is in fact
+correct as the orphaned program must had to be loaded for a
+different device.
+
+Fixes: c14a9f633d9e ("net: Don't call XDP_SETUP_PROG when nothing is changed")
+Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ net/core/dev.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -8421,7 +8421,8 @@ int dev_change_xdp_fd(struct net_device
+ return -EINVAL;
+ }
+
+- if (prog->aux->id == prog_id) {
++ /* prog->aux->id may be 0 for orphaned device-bound progs */
++ if (prog->aux->id && prog->aux->id == prog_id) {
+ bpf_prog_put(prog);
+ return 0;
+ }
diff --git a/series.conf b/series.conf
index 8d645b36be..e4538ddcf6 100644
--- a/series.conf
+++ b/series.conf
@@ -2899,6 +2899,7 @@
patches.suse/inet-stop-leaking-jiffies-on-the-wire.patch
patches.suse/net-phylink-Fix-phylink_dbg-macro.patch
patches.suse/net-cls_bpf-fix-NULL-deref-on-offload-filter-removal.patch
+ patches.suse/net-fix-installing-orphaned-programs.patch
patches.suse/powerpc-powernv-Fix-CPU-idle-to-be-called-with-IRQs-.patch
patches.suse/scsi-qla2xxx-fixup-incorrect-usage-of-host_byte.patch
patches.suse/scsi-lpfc-Check-queue-pointer-before-use.patch