osmo_io_uring: Check if osmo_fd_register fails at iofd_uring_notify_connected()

If it fails, do not set the IOFD_FLAG_NOTIFY_CONNECTED flag and log an
error message.

Closes: Coverity CID#349579
Change-Id: I34e8cc9a2b9df0c624841e5f9268a15c32418da1
This commit is contained in:
Andreas Eversberg 2024-03-01 17:47:44 +01:00 committed by laforge
parent a4ac5b8c26
commit ada88ce655
1 changed files with 4 additions and 2 deletions

View File

@ -496,8 +496,10 @@ static void iofd_uring_notify_connected(struct osmo_io_fd *iofd)
if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED)) {
osmo_fd_setup(&iofd->u.uring.connect_ofd, iofd->fd, OSMO_FD_WRITE,
iofd_uring_connected_cb, iofd, 0);
osmo_fd_register(&iofd->u.uring.connect_ofd);
IOFD_FLAG_SET(iofd, IOFD_FLAG_NOTIFY_CONNECTED);
if (osmo_fd_register(&iofd->u.uring.connect_ofd) < 0)
LOGPIO(iofd, LOGL_ERROR, "Failed to register FD for connect event.\n");
else
IOFD_FLAG_SET(iofd, IOFD_FLAG_NOTIFY_CONNECTED);
}
} else
iofd_uring_write_enable(iofd);