binder: free the shrinker when binder_init() fails

binder_init() registers the shrinker before init_binderfs(). On failure
the error path returns without binder_alloc_shrinker_exit(), and a failed
module init never runs binder_exit(). The module text is freed while the
shrinker stays registered.

Mainline fixed this in adb9743d6a08 ("binder: fix memory leak in
binder_init()"). Call the existing exit helper on
err_alloc_device_names_failed, which is only reached after a successful
shrinker init.
This commit is contained in:
Chris Olin 2026-10-30 16:07:38 -04:00
parent 4d68f90e11
commit aa2a988464

View File

@ -6271,6 +6271,7 @@ err_init_binder_device_failed:
err_alloc_device_names_failed: err_alloc_device_names_failed:
debugfs_remove_recursive(binder_debugfs_dir_entry_root); debugfs_remove_recursive(binder_debugfs_dir_entry_root);
binder_alloc_shrinker_exit();
return ret; return ret;
} }