[PATCH] randr: Better verify providers in SetProvider* requests.

Michal Srb msrb at suse.com
Fri Jun 13 05:49:57 PDT 2014


Return BadValue when the provider is main gpu (instead of aborting on assert
later) and when the sink and source are the same gpu (instead of breaking
and possibly crashing later).

diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index 4507ba8..31af871 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -292,11 +292,17 @@ ProcRRSetProviderOutputSource(ClientPtr client)
     if (!(provider->capabilities & RR_Capability_SinkOutput))
         return BadValue;
 
+    if (!provider->pScreen->isGPU)
+        return BadValue;
+
     if (stuff->source_provider) {
         VERIFY_RR_PROVIDER(stuff->source_provider, source_provider, DixReadAccess);
 
         if (!(source_provider->capabilities & RR_Capability_SourceOutput))
             return BadValue;
+
+        if (source_provider == provider)
+            return BadValue;
     }
 
     pScreen = provider->pScreen;
@@ -326,10 +332,16 @@ ProcRRSetProviderOffloadSink(ClientPtr client)
     if (!(provider->capabilities & RR_Capability_SourceOffload))
         return BadValue;
 
+    if (!provider->pScreen->isGPU)
+        return BadValue;
+
     if (stuff->sink_provider) {
         VERIFY_RR_PROVIDER(stuff->sink_provider, sink_provider, DixReadAccess);
         if (!(sink_provider->capabilities & RR_Capability_SinkOffload))
             return BadValue;
+
+        if (sink_provider == provider)
+            return BadValue;
     }
     pScreen = provider->pScreen;
     pScrPriv = rrGetScrPriv(pScreen);



More information about the xorg-devel mailing list