mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-12-03 18:15:59 +01:00
drm: Validate conn before dereference in CDRMAtomicRequest::commit() (#108)
During startup, CDRMAtomicImpl::reset() may emit a call to method
commit of a CDRMAtomicRequest instance with member "conn" uninitialized,
leading to a segfault. Validate the the pointer before dereference it as
a workaround.
Fixes: 55ac962
("DRM: preliminary atomic support")
Closes: https://github.com/hyprwm/aquamarine/issues/107
Signed-off-by: Yao Zi <ziyao@disroot.org>
This commit is contained in:
parent
b31a6a4da8
commit
4468981c1c
1 changed files with 4 additions and 1 deletions
|
@ -162,6 +162,9 @@ bool Aquamarine::CDRMAtomicRequest::commit(uint32_t flagssss) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!conn)
|
||||
return false;
|
||||
|
||||
if (auto ret = drmModeAtomicCommit(backend->gpu->fd, req, flagssss, &conn->pendingPageFlip); ret) {
|
||||
backend->log((flagssss & DRM_MODE_ATOMIC_TEST_ONLY) ? AQ_LOG_DEBUG : AQ_LOG_ERROR,
|
||||
std::format("atomic drm request: failed to commit: {}, flags: {}", strerror(-ret), flagsToStr(flagssss)));
|
||||
|
@ -365,4 +368,4 @@ bool Aquamarine::CDRMAtomicImpl::moveCursor(SP<SDRMConnector> connector, bool sk
|
|||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue