vhost: fix FD registration to the fdset

Message ID 20240617101334.211756-1-maxime.coquelin@redhat.com (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers
Series vhost: fix FD registration to the fdset |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

Maxime Coquelin June 17, 2024, 10:13 a.m. UTC
  A missing return statement in fdset_add() was making
the error path to be systematically executed, this patch
adds it back.

Bugzilla ID: 1462
Fixes: 0e38b42bf61c ("vhost: manage FD with epoll")

Reported-by: Jiang Yu <yux.jiang@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/fd_man.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

David Marchand June 17, 2024, 2:25 p.m. UTC | #1
On Mon, Jun 17, 2024 at 12:13 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> A missing return statement in fdset_add() was making
> the error path to be systematically executed, this patch
> adds it back.
>
> Bugzilla ID: 1462
> Fixes: 0e38b42bf61c ("vhost: manage FD with epoll")

It looks like the initial code was better ;-).

>
> Reported-by: Jiang Yu <yux.jiang@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied directly in main for rc1, thanks.
  

Patch

diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 12c0f2c2b3..87a8dc3f3e 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -242,6 +242,7 @@  fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat)
 		goto out_remove;
 	}
 
+	return 0;
 out_remove:
 	pthread_mutex_lock(&pfdset->fd_mutex);
 	pfdentry = fdset_find_entry_locked(pfdset, fd);