Skip to content

Doublely-free in remove_self_from_waiters() #57

@vicLin8712

Description

@vicLin8712

Issue

In kernel/mutex.c, remove_self_from_waiters() calls list_remove() and free() at the same time, which free() has been called in the list_remove() may cause heap corruption or invalid free.

static bool remove_self_from_waiters(list_t *waiters)
{
 ...
    while (curr && curr != waiters->tail) {
        if (curr->data == self) {
            list_remove(waiters, curr);
            free(curr);
            return true;
        }
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions