SecurityResource should not segfault when client owning resource has exited

Fixes OpenSolaris bug 6949754:
  Xorg crashes when the magnifier is enabled at gdm login greeter window.
  http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6949754

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
This commit is contained in:
Sam Lau 2010-06-03 19:17:14 -07:00 committed by Alan Coopersmith
parent 07a093add0
commit 1c08a37e0e

View File

@ -805,7 +805,6 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
Mask allowed = SecurityResourceMask; Mask allowed = SecurityResourceMask;
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
/* disable background None for untrusted windows */ /* disable background None for untrusted windows */
if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW)) if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
@ -831,8 +830,11 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
allowed |= DixReadAccess; allowed |= DixReadAccess;
} }
if (clients[cid] != NULL) {
obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, requested, allowed) == Success) if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
return; return;
}
SecurityAudit("Security: denied client %d access %x to resource 0x%x " SecurityAudit("Security: denied client %d access %x to resource 0x%x "
"of client %d on request %s\n", rec->client->index, "of client %d on request %s\n", rec->client->index,