From 1ac3763815e804eacc0977afb420f015a78f8d72 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 23 Sep 2022 08:48:38 +0200
Subject: [PATCH] backport-5.4: add a BPF off-by-one fix

Signed-off-by: John Crispin <john@phrozen.org>
---
 .../backport-5.4/999-bpf-off-by-one-backport.patch  | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 target/linux/generic/backport-5.4/999-bpf-off-by-one-backport.patch

diff --git a/target/linux/generic/backport-5.4/999-bpf-off-by-one-backport.patch b/target/linux/generic/backport-5.4/999-bpf-off-by-one-backport.patch
new file mode 100644
index 0000000000..271eac67da
--- /dev/null
+++ b/target/linux/generic/backport-5.4/999-bpf-off-by-one-backport.patch
@@ -0,0 +1,13 @@
+Index: linux-5.4.158/kernel/bpf/verifier.c
+===================================================================
+--- linux-5.4.158.orig/kernel/bpf/verifier.c
++++ linux-5.4.158/kernel/bpf/verifier.c
+@@ -5372,7 +5372,7 @@ static void find_good_pkt_pointers(struc
+ 
+ 	new_range = dst_reg->off;
+ 	if (range_right_open)
+-		new_range--;
++		new_range++;
+ 
+ 	/* Examples for register markings:
+ 	 *
-- 
2.25.1

