[Wayland-bugs] [Bug 91872] libinput context refcounting frees memory early

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Sep 3 20:46:30 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=91872

            Bug ID: 91872
           Summary: libinput context refcounting  frees memory early
           Product: Wayland
           Version: unspecified
          Hardware: Other
                OS: All
            Status: ASSIGNED
          Severity: normal
          Priority: medium
         Component: libinput
          Assignee: wayland-bugs at lists.freedesktop.org
          Reporter: peter.hutterer at who-t.net

The refcounting on the context itself does not take client-held references in
the child structs into account.

Pseudocode example:
        li = libinput_path_create_context(&interface, NULL);
        device = libinput_path_add_device(li, "/dev/input/event0");
        libinput_device_ref(device);
        libinput_unref(li); <--- resources are cleaned up

The device has a refcount of at least 1 on cleanup, the client has access to
the struct and could, in the future, try to call libinput_device_get_context().

However, the libinput context is cleaned up and all devices are removed. The
device the client has a ref to points to a freed memory.

This also affects libinput_device_groups if the device is removed with a ref to
the group still handling. It does not affect seats, since the context always
has a ref to the seat and the bug simply isn't triggered.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-bugs/attachments/20150904/702ca217/attachment.html>


More information about the wayland-bugs mailing list