mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 17:03:23 +00:00
Check file_table before use
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
00e6905d93
commit
2f097ab8f8
@ -27,12 +27,13 @@ impl FdDirOps {
|
|||||||
.parent(parent)
|
.parent(parent)
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
file_table
|
// Guard against the race condition when procfs is being accessed for an exiting process,
|
||||||
.lock()
|
// whose file table may have already been released.
|
||||||
.as_ref()
|
if let Some(file_table_ref) = file_table.lock().as_ref() {
|
||||||
.unwrap()
|
file_table_ref
|
||||||
.read()
|
.read()
|
||||||
.register_observer(Arc::downgrade(&fd_inode) as _);
|
.register_observer(Arc::downgrade(&fd_inode) as _);
|
||||||
|
}
|
||||||
|
|
||||||
fd_inode
|
fd_inode
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user