mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 05:42:46 +01:00
rust_binder: avoid mem::take on delivered_deaths
Similar to the previous commit, List::remove is used on
delivered_deaths, so do not use mem::take on it as that may result in
violations of the List::remove safety requirements.
I don't think this particular case can be triggered because it requires
fd close to run in parallel with an ioctl on the same fd. But let's not
tempt fate.
Cc: [email protected]
Fixes: eafedbc7c0 ("rust_binder: add Rust Binder driver")
Signed-off-by: Alice Ryhl <[email protected]>
Acked-by: Miguel Ojeda <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
1 parent
3e0ae02ba8
commit
6c37bebd8c
1 file changed
+6
-2
@@ -1362,8 +1362,12 @@ impl Process {
|
||||
work.into_arc().cancel();
|
||||
}
|
||||
|
||||
let delivered_deaths = take(&mut self.inner.lock().delivered_deaths);
|
||||
drop(delivered_deaths);
|
||||
// Clear delivered_deaths list.
|
||||
//
|
||||
// Scope ensures that MutexGuard is dropped while executing the body.
|
||||
while let Some(delivered_death) = { self.inner.lock().delivered_deaths.pop_front() } {
|
||||
drop(delivered_death);
|
||||
}
|
||||
|
||||
// Free any resources kept alive by allocated buffers.
|
||||
let omapping = self.inner.lock().mapping.take();
|
||||
|
||||
Reference in new issue
Block a user