osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/41365?usp=email )

Change subject: io_uring: Avoid extra reads if iofd becomes unregistered by user
......................................................................

io_uring: Avoid extra reads if iofd becomes unregistered by user

The user callback (read_cb, segmentation_cb, etc.) may decide to
unregister the iofd instead of closing it. In this scenario, we should
avoid calling the callback further until the iofd is registered again.

This is a backport of master branch commit
32efc324ce0b30280effef4860bb15588ecb1010.

Change-Id: I514412ecfbb82d32cb3d9c2272795ebac42f55e9
---
M src/core/osmo_io_uring.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved




diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c
index b8b240f..cfd72fd 100644
--- a/src/core/osmo_io_uring.c
+++ b/src/core/osmo_io_uring.c
@@ -189,10 +189,10 @@
        if (rc > 0)
                msgb_put(msg, rc);

-       if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
+       if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
                iofd_handle_recv(iofd, msg, rc, msghdr);

-       if (iofd->u.uring.read_enabled && !IOFD_FLAG_ISSET(iofd, 
IOFD_FLAG_CLOSED))
+       if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED) && 
iofd->u.uring.read_enabled)
                iofd_uring_submit_recv(iofd, msghdr->action);
        else
                iofd->u.uring.read_msghdr = NULL;

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41365?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: osmith/1.11.3
Gerrit-Change-Id: I514412ecfbb82d32cb3d9c2272795ebac42f55e9
Gerrit-Change-Number: 41365
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to