When automatically removing a watch, inotify_log_one() checked only that a watch with the same watch descriptor was still registered, not that it was the same watch. Watch descriptors are allocated from a 32-bit counter, so by forcing the counter to wrap around, a user could cause a new watch to reuse the descriptor of one being removed concurrently. The kernel could then free a watch which was still in use, resulting in a use-after-free. An unprivileged local user may be able to exploit the bug to escalate privileges, potentially gaining full control of the affected system.