diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2024-03-01 17:47:44 +0100 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2024-03-02 09:29:10 +0000 |
commit | ada88ce655113228f769746dc8fef6c5b4148bc5 (patch) | |
tree | f18b09a2e8780a9151138d4ee16ea203a2ed3e92 /src | |
parent | a4ac5b8c26a47587ac0985369874f6be13243e8a (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/core/osmo_io_uring.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c index cb636da1..b174b224 100644 --- a/src/core/osmo_io_uring.c +++ b/src/core/osmo_io_uring.c @@ -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); |