Message ID | 1593937189-8744-3-git-send-email-yishaih@mellanox.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | None | expand |
diff --git a/libibverbs/device.c b/libibverbs/device.c index 4629bbf..629832e 100644 --- a/libibverbs/device.c +++ b/libibverbs/device.c @@ -378,7 +378,8 @@ void verbs_uninit_context(struct verbs_context *context_ex) { free(context_ex->priv); close(context_ex->context.cmd_fd); - close(context_ex->context.async_fd); + if (context_ex->context.async_fd != -1) + close(context_ex->context.async_fd); ibverbs_device_put(context_ex->context.device); }
Close async_fd only when it was previously created, otherwise the call will fail and errno from previous failure (if exists) will be overwritten. Fixes: 1111cf9895bb ("verbs: Always allocate a verbs_context") Signed-off-by: Yishai Hadas <yishaih@mellanox.com> --- libibverbs/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)