Skip to contentSkip to conversation

fbarray: check fbarray lock downgrade failure

PATCH Superseded Daniil Iskhakov 1 participant 1 message Jul 18

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbarray: check fbarray lock downgrade failure

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]
Cc: [email protected]
Cc: [email protected]

---
 lib/eal/common/eal_common_fbarray.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/eal/common/eal_common_fbarray.c +3 -1
index 8bdcefb717..5a694ccdae 100644
@@ -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;
Signature · 1 line
2.43.0