Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 805ca7a1 authored by Andrei Homescu's avatar Andrei Homescu
Browse files

libbinder: Handle peer closing connection in Trusty

Fix the code handling incoming messages in RpcTransportTipcTrusty
to return DEAD_OBJECT if the peer closed the connection
instead of OK.

Bug: 230135749
Test: binderRpcTest on Trusty
Change-Id: I0ff50e31bd1823bcb568119887453f34c380c1d8
parent 7e560fe5
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -63,12 +63,14 @@ public:
        if (pfd.revents & POLLERR) {
            return DEAD_OBJECT;
        }
        if (pfd.revents & POLLHUP) {
            return DEAD_OBJECT;
        }
        if (pfd.revents & POLLIN) {
            // Copied from FdTrigger.cpp: Even though POLLHUP may also be set,
            // treat it as a success condition to ensure data is drained.
            return OK;
        }
        if (pfd.revents & POLLHUP) {
            return DEAD_OBJECT;
        }

        return WOULD_BLOCK;
    }
+6 −0
Original line number Diff line number Diff line
@@ -239,6 +239,12 @@ private:
        }
        if (!(uevt.event & IPC_HANDLE_POLL_MSG)) {
            /* No message, terminate here and leave mHaveMessage false */
            if (uevt.event & IPC_HANDLE_POLL_HUP) {
                // Peer closed the connection. We need to preserve the order
                // between MSG and HUP from FdTrigger.cpp, which means that
                // getting MSG&HUP should return OK instead of DEAD_OBJECT.
                return DEAD_OBJECT;
            }
            return OK;
        }