diff options
author | Simon Farnsworth <simon.farnsworth@onelan.com> | 2010-06-22 10:13:30 +0100 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2010-09-04 11:39:54 -0700 |
commit | 853410a873882623e4244c72ada17c59852778d5 (patch) | |
tree | 75ffde4d413761a0697614e455432a71cb91b9c5 | |
parent | 929d43d3daeaa8b0df1479f6be432625ef13a340 (diff) |
Don't crash when asked if a client that has disconnected was local
ProcDRI2Dispatch uses LocalClient to determine if it's safe to respond
to a client that has made DRI2 requests which aren't sensible for
remote clients (anything but version). When the client has disappeared
mid-request stream (e.g. as a result of a kill -9, or a client-side
bug), LocalClient causes the X server to follow suit, as
((OsCommPtr)client->osPrivate)->trans_conn is NULL at this point.
The simple and obvious fix is to just return "not local" when
trans_conn is NULL, which fixes the crash I was seeing; however Keith
Packard pointed out that just checking trans_conn isn't enough;
quoting Keith:
"This looks almost right to me -- I reviewed the os code to see when
_XSERVTransClose is called (which is what frees the trans_conn data) and
found that every place which called that immediately set trans_conn to
NULL, except for the call in CloseDownFileDescriptor which is only
called from CloseDownConnection and which is immediately followed by
freeing the OsCommRec and setting client->osPrivate to NULL. So, I'd
suggest checking client->osPrivate in addition to the above check."
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 660f6ab5494a728c3ca7ba00c305e9ff06c8ecb2)
-rw-r--r-- | os/access.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/os/access.c b/os/access.c index 3572da0c9..859f32ef9 100644 --- a/os/access.c +++ b/os/access.c @@ -1123,6 +1123,11 @@ Bool LocalClient(ClientPtr client) pointer addr; register HOST *host; + if (!client->osPrivate) + return FALSE; + if (!((OsCommPtr)client->osPrivate)->trans_conn) + return FALSE; + if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn, ¬used, &alen, &from)) { |