Return value of eal_file_lock() is ignored in the fbarray destroy error
path.

Check the return value and log the downgrade failure while keeping the
original rte_errno reported by unlink().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 176bb37ca6f3 ("eal: introduce internal wrappers for file operations")
Cc: [email protected]

Signed-off-by: Daniil Iskhakov <[email protected]>
---
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
 lib/eal/common/eal_common_fbarray.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/eal/common/eal_common_fbarray.c 
b/lib/eal/common/eal_common_fbarray.c
index 8bdcefb717..5a694ccdae 100644
--- a/lib/eal/common/eal_common_fbarray.c
+++ b/lib/eal/common/eal_common_fbarray.c
@@ -1022,7 +1022,9 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
                         * we're still holding an exclusive lock, so drop it to
                         * shared.
                         */
-                       eal_file_lock(fd, EAL_FLOCK_SHARED, EAL_FLOCK_RETURN);
+                       if (eal_file_lock(fd, EAL_FLOCK_SHARED, 
EAL_FLOCK_RETURN))
+                               EAL_LOG(DEBUG, "Cannot restore fbarray shared 
lock: %s",
+                                       rte_strerror(rte_errno));
 
                        ret = -1;
                        goto out;
-- 
2.43.0

Reply via email to