mirror of
https://github.com/Smithay/smithay.git
synced 2024-09-28 03:21:14 +02:00
shm: guard against pool destruction race condition
It might happen that a buffer is cached somewhere while the pool has been set to null after a resize failed
This commit is contained in:
parent
d763452a08
commit
a6e96ce78a
1 changed files with 14 additions and 0 deletions
|
@ -116,6 +116,13 @@ impl InnerPool {
|
|||
|
||||
let pool_guard = self.map.read().unwrap();
|
||||
|
||||
// This should not happen, but in case a pool resize failed (which result in a protocol error
|
||||
// and will kill the client) and the buffer got cached somewhere it is possible that we try to access
|
||||
// a dead pool.
|
||||
if pool_guard.ptr.is_null() {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
trace!(fd = ?self.fd, "Buffer access on shm pool");
|
||||
|
||||
// Prepare the access
|
||||
|
@ -152,6 +159,13 @@ impl InnerPool {
|
|||
|
||||
let pool_guard = self.map.write().unwrap();
|
||||
|
||||
// This should not happen, but in case a pool resize failed (which result in a protocol error
|
||||
// and will kill the client) and the buffer got cached somewhere it is possible that we try to access
|
||||
// a dead pool.
|
||||
if pool_guard.ptr.is_null() {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
trace!(fd = ?self.fd, "Mutable buffer access on shm pool");
|
||||
|
||||
// Prepare the access
|
||||
|
|
Loading…
Reference in a new issue