resource: Remove expectID hack
This is clearly meant to short-circuit the (modestly) expensive resource lookup in LegalNewID. The problem is that long-lived clients will eventually run completely through their XID space and start asking XC-MISC for IDs to reuse. Once that happens, the comparison against expectID will always be true, and we'll no longer catch XID collisions at all. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
3282e3c627
commit
cb61cf5c99
|
@ -175,7 +175,6 @@ typedef struct _ClientResource {
|
||||||
int hashsize; /* log(2)(buckets) */
|
int hashsize; /* log(2)(buckets) */
|
||||||
XID fakeID;
|
XID fakeID;
|
||||||
XID endFakeID;
|
XID endFakeID;
|
||||||
XID expectID;
|
|
||||||
} ClientResourceRec;
|
} ClientResourceRec;
|
||||||
|
|
||||||
RESTYPE lastResourceType;
|
RESTYPE lastResourceType;
|
||||||
|
@ -322,7 +321,6 @@ InitClientResources(ClientPtr client)
|
||||||
clientTable[i].fakeID = client->clientAsMask |
|
clientTable[i].fakeID = client->clientAsMask |
|
||||||
(client->index ? SERVER_BIT : SERVER_MINID);
|
(client->index ? SERVER_BIT : SERVER_MINID);
|
||||||
clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
|
clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
|
||||||
clientTable[i].expectID = client->clientAsMask;
|
|
||||||
for (j=0; j<INITBUCKETS; j++)
|
for (j=0; j<INITBUCKETS; j++)
|
||||||
{
|
{
|
||||||
clientTable[i].resources[j] = NULL;
|
clientTable[i].resources[j] = NULL;
|
||||||
|
@ -511,8 +509,6 @@ AddResource(XID id, RESTYPE type, pointer value)
|
||||||
res->value = value;
|
res->value = value;
|
||||||
*head = res;
|
*head = res;
|
||||||
rrec->elements++;
|
rrec->elements++;
|
||||||
if (!(id & SERVER_BIT) && (id >= rrec->expectID))
|
|
||||||
rrec->expectID = id + 1;
|
|
||||||
CallResourceStateCallback(ResourceStateAdding, res);
|
CallResourceStateCallback(ResourceStateAdding, res);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -895,9 +891,6 @@ LegalNewID(XID id, ClientPtr client)
|
||||||
#endif /* PANORAMIX */
|
#endif /* PANORAMIX */
|
||||||
if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
|
if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
|
||||||
{
|
{
|
||||||
if (clientTable[client->index].expectID <= id)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
|
rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
|
||||||
DixGetAttrAccess);
|
DixGetAttrAccess);
|
||||||
return rc == BadValue;
|
return rc == BadValue;
|
||||||
|
|
Loading…
Reference in New Issue