Re: [PATCH v9 0/9] drivers/base: Introduce revocable

From: Bartosz Golaszewski

Date: Tue Apr 28 2026 - 04:23:41 EST


On Mon, 27 Apr 2026 15:58:32 +0200, Tzung-Bi Shih <tzungbi@xxxxxxxxxx> said:
> This series introduces the "revocable" mechanism, a synchronization
> primitive designed to prevent Use-After-Free errors.
>
> - Patch 1 introduces the revocable which is an implementation of ideas
> from the talk [1].
>
> - Patch 2 adds KUnit test cases.
>
> - Patches 3 to 7 transitions the UAF prevention logic within the GPIO
> core (gpiolib) to use the "revocable" mechanism.
>
> The existing code aims to prevent UAF issues when the underlying GPIO
> chip is removed. They replace that custom logic with the generic
> "revocable" API, which is designed to handle such lifecycle
> dependencies. There should be no changes in behavior.
>
> - Patches 8 to 9 uses "revocable" mechanism to fix an UAF in
> cros_ec_chardev driver. Alternatively, [2] is a series for fixing the
> same issue without using "revocable".
>
> Since v9, there are two ways to manage the resource provider handle.
> - Embedded allocation: patches 3 to 7 might be the potential user.
> - Dynamic allocation: patches 8 to 9 might be the potential user.
>
> [1] https://lpc.events/event/17/contributions/1627/
> [2] https://lore.kernel.org/all/20260427134659.95181-1-tzungbi@xxxxxxxxxx
>
> ---
> v9:
> - Rebase onto v7.1-rc1.
> - Remove the selftests patch as it makes less sense to test revocable
> APIs via kselftests.

May I suggest kunit for that purpose?

Bart