Re: [RFC PATCH] cocci: cpi: add complete api check script

From: Peter Zijlstra
Date: Mon Feb 27 2023 - 10:44:28 EST


On Mon, Feb 27, 2023 at 10:28:08AM -0500, Steven Rostedt wrote:

> So what exact race are you trying to catch here?

on-stack copmletion with a wait_for_completion that can return early
(eg. killable, interruptible, or timeout) can go out of scope (eg, free
the completion) with the other side calling complete() on some possibly
re-used piece of stack.

IOW, Use-after-Free.

Care must be taken to ensure the other side (whatever does complete())
is either terminated or otherwise stopped from calling complete() on an
out-of-scope variable.