[SRU][F:linux-bluefield][PATCH 4/4] psample: Fix user API breakage

Bodong Wang bodong at nvidia.com
Wed Oct 6 22:52:35 UTC 2021


From: Ido Schimmel <idosch at nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/1946266

Cited commit added a new attribute before the existing group reference
count attribute, thereby changing its value and breaking existing
applications on new kernels.

Before:

 # psample -l
 libpsample ERROR psample_group_foreach: failed to recv message: Operation not supported

After:

 # psample -l
 Group Num       Refcount        Group Seq
 1               1               0

Fix by restoring the value of the old attribute and remove the
misleading comments from the enumerator to avoid future bugs.

Cc: stable at vger.kernel.org
Fixes: d8bed686ab96 ("net: psample: Add tunnel support")
Signed-off-by: Ido Schimmel <idosch at nvidia.com>
Reported-by: Adiel Bidani <adielb at nvidia.com>
Reviewed-by: Jiri Pirko <jiri at nvidia.com>
Reviewed-by: Petr Machata <petrm at nvidia.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from e43accba9b071dcd106b5e7643b1b106a158cbb1)
Signed-off-by: Bodong Wang <bodong at nvidia.com>
---
 include/uapi/linux/psample.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/include/uapi/linux/psample.h b/include/uapi/linux/psample.h
index aea26ab..bff5032 100644
--- a/include/uapi/linux/psample.h
+++ b/include/uapi/linux/psample.h
@@ -3,7 +3,6 @@
 #define __UAPI_PSAMPLE_H
 
 enum {
-	/* sampled packet metadata */
 	PSAMPLE_ATTR_IIFINDEX,
 	PSAMPLE_ATTR_OIFINDEX,
 	PSAMPLE_ATTR_ORIGSIZE,
@@ -11,10 +10,8 @@ enum {
 	PSAMPLE_ATTR_GROUP_SEQ,
 	PSAMPLE_ATTR_SAMPLE_RATE,
 	PSAMPLE_ATTR_DATA,
-	PSAMPLE_ATTR_TUNNEL,
-
-	/* commands attributes */
 	PSAMPLE_ATTR_GROUP_REFCOUNT,
+	PSAMPLE_ATTR_TUNNEL,
 
 	__PSAMPLE_ATTR_MAX
 };
-- 
1.8.3.1




More information about the kernel-team mailing list