jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/36132?usp=email )
Change subject: osmo_io_uring: Check if osmo_fd_register fails at iofd_uring_notify_connected() ......................................................................
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 --- M src/core/osmo_io_uring.c 1 file changed, 17 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/32/36132/1
diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c index cb636da..b174b22 100644 --- a/src/core/osmo_io_uring.c +++ b/src/core/osmo_io_uring.c @@ -496,8 +496,10 @@ 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);