Blame SOURCES/0008-libibverbs-Fix-ABI_placeholder1-and-ABI_placeholder2.patch

b4bffb
From fccce505db388fbea2d65fb662111702bc60ad25 Mon Sep 17 00:00:00 2001
b4bffb
From: Honggang Li <honli@redhat.com>
b4bffb
Date: Thu, 4 Jun 2020 14:33:38 +0800
b4bffb
Subject: [PATCH 8/8] libibverbs: Fix ABI_placeholder1 and ABI_placeholder2
b4bffb
 assignment
b4bffb
b4bffb
The assignment of ABI_placeholder1 and ABI_placeholder2 must be
b4bffb
after the provider populated context_ex->ibv_create_flow and
b4bffb
context_ex->ibv_destroy_flow.
b4bffb
b4bffb
Applications, which compiled against old libibverbs released between
b4bffb
commit 501b53b30752 and 1111cf9895bb, will fail if they are linked
b4bffb
with libibverbs released after 1111cf9895bb and call ibv_create_flow.
b4bffb
b4bffb
[1] 501b53b30752 ("Fix create/destroy flow API")
b4bffb
b4bffb
Fixes: 1111cf9895bb ("verbs: Always allocate a verbs_context")
b4bffb
Signed-off-by: Honggang Li <honli@redhat.com>
b4bffb
(cherry picked from commit 88789b7ba618d55491026c74a9a31699805e5934)
b4bffb
Signed-off-by: Honggang Li <honli@redhat.com>
b4bffb
---
b4bffb
 libibverbs/device.c | 34 +++++++++++++++++-----------------
b4bffb
 1 file changed, 17 insertions(+), 17 deletions(-)
b4bffb
b4bffb
diff --git a/libibverbs/device.c b/libibverbs/device.c
b4bffb
index bc7df1b06435..db97655c2d9e 100644
b4bffb
--- a/libibverbs/device.c
b4bffb
+++ b/libibverbs/device.c
b4bffb
@@ -256,23 +256,6 @@ int verbs_init_context(struct verbs_context *context_ex,
b4bffb
 	context_ex->context.abi_compat = __VERBS_ABI_IS_EXTENDED;
b4bffb
 	context_ex->sz = sizeof(*context_ex);
b4bffb
 
b4bffb
-	/*
b4bffb
-	 * In order to maintain backward/forward binary compatibility
b4bffb
-	 * with apps compiled against libibverbs-1.1.8 that use the
b4bffb
-	 * flow steering addition, we need to set the two
b4bffb
-	 * ABI_placeholder entries to match the driver set flow
b4bffb
-	 * entries.  This is because apps compiled against
b4bffb
-	 * libibverbs-1.1.8 use an inline ibv_create_flow and
b4bffb
-	 * ibv_destroy_flow function that looks in the placeholder
b4bffb
-	 * spots for the proper entry points.  For apps compiled
b4bffb
-	 * against libibverbs-1.1.9 and later, the inline functions
b4bffb
-	 * will be looking in the right place.
b4bffb
-	 */
b4bffb
-	context_ex->ABI_placeholder1 =
b4bffb
-		(void (*)(void))context_ex->ibv_create_flow;
b4bffb
-	context_ex->ABI_placeholder2 =
b4bffb
-		(void (*)(void))context_ex->ibv_destroy_flow;
b4bffb
-
b4bffb
 	context_ex->priv = calloc(1, sizeof(*context_ex->priv));
b4bffb
 	if (!context_ex->priv) {
b4bffb
 		errno = ENOMEM;
b4bffb
@@ -330,6 +313,23 @@ static void set_lib_ops(struct verbs_context *vctx)
b4bffb
 #undef ibv_query_port
b4bffb
 	vctx->context.ops._compat_query_port = ibv_query_port;
b4bffb
 	vctx->query_port = __lib_query_port;
b4bffb
+
b4bffb
+	/*
b4bffb
+	 * In order to maintain backward/forward binary compatibility
b4bffb
+	 * with apps compiled against libibverbs-1.1.8 that use the
b4bffb
+	 * flow steering addition, we need to set the two
b4bffb
+	 * ABI_placeholder entries to match the driver set flow
b4bffb
+	 * entries.  This is because apps compiled against
b4bffb
+	 * libibverbs-1.1.8 use an inline ibv_create_flow and
b4bffb
+	 * ibv_destroy_flow function that looks in the placeholder
b4bffb
+	 * spots for the proper entry points.  For apps compiled
b4bffb
+	 * against libibverbs-1.1.9 and later, the inline functions
b4bffb
+	 * will be looking in the right place.
b4bffb
+	 */
b4bffb
+	vctx->ABI_placeholder1 =
b4bffb
+		(void (*)(void))vctx->ibv_create_flow;
b4bffb
+	vctx->ABI_placeholder2 =
b4bffb
+		(void (*)(void))vctx->ibv_destroy_flow;
b4bffb
 }
b4bffb
 
b4bffb
 struct ibv_context *verbs_open_device(struct ibv_device *device, void *private_data)
b4bffb
-- 
b4bffb
2.25.4
b4bffb