ANDROID: rust_binder: remove binder_logs/procs/pid immediately

Currently the binder_logs/procs/pid file is removed in the deferred
release callback that runs on the workqueue, which means that it may run
after the underlying filesystem is unmounted. However, dentries must be
removed before the filesystem goes away, so remove it explicitly when
scheduling the deferred release callback.

Bug: 426116428
Change-Id: I77db9261711989f8d4cd4c3a22903ff83a3fa9b7
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
Alice Ryhl
2025-06-30 08:12:55 +00:00
committed by Carlos Llamas
parent dd35623c83
commit f6b1ab83f6

View File

@@ -1552,11 +1552,13 @@ impl Process {
}
pub(crate) fn release(this: Arc<Process>, _file: &File) {
let binderfs_file;
let should_schedule;
{
let mut inner = this.inner.lock();
should_schedule = inner.defer_work == 0;
inner.defer_work |= PROC_DEFER_RELEASE;
binderfs_file = inner.binderfs_file.take();
}
if should_schedule {
@@ -1564,6 +1566,8 @@ impl Process {
// scheduled for execution.
let _ = workqueue::system().enqueue(this);
}
drop(binderfs_file);
}
pub(crate) fn flush(this: ArcBorrow<'_, Process>) -> Result {