Skip to content

Commit

Permalink
verbs: Close async_fd only when it was previously created
Browse files Browse the repository at this point in the history
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: 1111cf9 ("verbs: Always allocate a verbs_context")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
  • Loading branch information
yishaih committed Jul 9, 2020
1 parent 50937d0 commit 5f200b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libibverbs/device.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 5f200b1

Please sign in to comment.