Skip to content

Commit 4468981

Browse files
authored
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: #107 Signed-off-by: Yao Zi <[email protected]>
1 parent b31a6a4 commit 4468981

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/drm/impl/Atomic.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ bool Aquamarine::CDRMAtomicRequest::commit(uint32_t flagssss) {
162162
return false;
163163
}
164164

165+
if (!conn)
166+
return false;
167+
165168
if (auto ret = drmModeAtomicCommit(backend->gpu->fd, req, flagssss, &conn->pendingPageFlip); ret) {
166169
backend->log((flagssss & DRM_MODE_ATOMIC_TEST_ONLY) ? AQ_LOG_DEBUG : AQ_LOG_ERROR,
167170
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
365368
}
366369

367370
return true;
368-
}
371+
}

0 commit comments

Comments
 (0)