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

Commit aef61410 authored by Ady Abraham's avatar Ady Abraham Committed by Automerger Merge Worker
Browse files

SurfaceFlinger: fix a potential race condition in stealReceiveChannel am: 899e8cd0

parents 6d4d2090 899e8cd0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -177,6 +177,11 @@ void EventThreadConnection::onFirstRef() {
}

binder::Status EventThreadConnection::stealReceiveChannel(gui::BitTube* outChannel) {
    std::scoped_lock lock(mLock);
    if (mChannel.initCheck() != NO_ERROR) {
        return binder::Status::fromStatusT(NAME_NOT_FOUND);
    }

    outChannel->setReceiveFd(mChannel.moveReceiveFd());
    outChannel->setSendFd(base::unique_fd(dup(mChannel.getSendFd())));
    return binder::Status::ok();
+2 −1
Original line number Diff line number Diff line
@@ -112,7 +112,8 @@ public:
private:
    virtual void onFirstRef();
    EventThread* const mEventThread;
    gui::BitTube mChannel;
    std::mutex mLock;
    gui::BitTube mChannel GUARDED_BY(mLock);

    std::vector<DisplayEventReceiver::Event> mPendingEvents;
};