Re: [PATCH v4] rust_binder: unregister shrinker if binderfs initialization fails
From: Alice Ryhl
Date: Thu Dec 03 2026 - 03:20:16 EST
On Thu, Dec 3, 2026 at 4:23 AM Poil Zero <poilandgginchi@xxxxxxxxx> wrote:
>
> BinderModule::init() registers the Binder shrinker before initializing
> binderfs. If init_rust_binderfs() fails, the driver returns an error
> but leaves the shrinker registered and its list_lru allocated.
>
> Unregister the shrinker on this error path before destroying its
> list_lru so that active reclaim callbacks finish before teardown.
> Return the original binderfs error.
>
> Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
> Signed-off-by: Poil Zero <poilandgginchi@xxxxxxxxx>
I think it'd make sense to also update the safety comment on the
shrinker's new() method to say that the shrinker must not have been
unregistered. Or just make unregister() unsafe.
Alice