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

Commit c0b2b0c4 authored by Chia-I Wu's avatar Chia-I Wu
Browse files

surfaceflinger: handle executeCommands transaction errors

Unlike other functions, executeCommands both sends and receives
handles.  It can fail for reasons such as out-of-fd.  We want to
protect SurfaceFlinger against out-of-fd.

Bug: 65449888
Test: manual
Change-Id: Id9420dbd6d0a943737c90bd3a1ae0df3805a4cb0
parent a60e6a45
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -755,7 +755,7 @@ Error Composer::execute()
    }

    Error error = kDefaultError;
    mClient->executeCommands(commandLength, commandHandles,
    auto ret = mClient->executeCommands(commandLength, commandHandles,
            [&](const auto& tmpError, const auto& tmpOutChanged,
                const auto& tmpOutLength, const auto& tmpOutHandles)
            {
@@ -788,6 +788,11 @@ Error Composer::execute()
                    error = Error::NO_RESOURCES;
                }
            });
    // executeCommands can fail because of out-of-fd and we do not want to
    // abort() in that case
    if (!ret.isOk()) {
        ALOGE("executeCommands failed because of %s", ret.description().c_str());
    }

    if (error == Error::NONE) {
        std::vector<CommandReader::CommandError> commandErrors =