Hello All:
    This is patch 3 of the 5 patches. It's based on 2.6.32-rc3+patch1+patch2. 
It enhance the DRM robustness, 
such as memory check before release or content comparison.

3 files has been modified for this patch.

Sign-off by Bruce C. Chang <brucech...@via.com.tw>
diff -Nur linux-2.6.32-rc3-old/drivers/gpu/drm/via/via_dmablit.c 
linux-2.6.32-rc3-new/drivers/gpu/drm/via/via_dmablit.c
--- linux-2.6.32-rc3-old/drivers/gpu/drm/via/via_dmablit.c      2009-10-05 
08:12:30.000000000 +0800
+++ linux-2.6.32-rc3-new/drivers/gpu/drm/via/via_dmablit.c      2009-10-08 
10:18:08.000000000 +0800
@@ -195,8 +195,10 @@
        default:
                vsg->state = dr_via_sg_init;
        }
-       vfree(vsg->bounce_buffer);
-       vsg->bounce_buffer = NULL;
+       if (vsg->bounce_buffer) {
+               vfree(vsg->bounce_buffer);
+               vsg->bounce_buffer = NULL;
+       }
        vsg->free_on_sequence = 0;
 }
 
diff -Nur linux-2.6.32-rc3-old/drivers/gpu/drm/via/via_irq.c 
linux-2.6.32-rc3-new/drivers/gpu/drm/via/via_irq.c
--- linux-2.6.32-rc3-old/drivers/gpu/drm/via/via_irq.c  2009-10-05 
08:12:30.000000000 +0800
+++ linux-2.6.32-rc3-new/drivers/gpu/drm/via/via_irq.c  2009-10-08 
10:18:08.000000000 +0800
@@ -357,6 +357,8 @@
        drm_via_irq_t *cur_irq = dev_priv->via_irqs;
        int force_sequence;
 
+       if (!dev->pdev->irq)
+               return -EINVAL;
        if (irqwait->request.irq >= dev_priv->num_irqs) {
                DRM_ERROR("Trying to wait on unknown irq %d\n",
                          irqwait->request.irq);
diff -Nur linux-2.6.32-rc3-old/drivers/gpu/drm/via/via_mm.c 
linux-2.6.32-rc3-new/drivers/gpu/drm/via/via_mm.c
--- linux-2.6.32-rc3-old/drivers/gpu/drm/via/via_mm.c   2009-10-08 
10:17:39.000000000 +0800
+++ linux-2.6.32-rc3-new/drivers/gpu/drm/via/via_mm.c   2009-10-08 
10:18:08.000000000 +0800
@@ -91,6 +91,17 @@
 int via_final_context(struct drm_device *dev, int context)
 {
        drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
+       struct drm_ctx_list *pos, *n;
+       bool context_valid = 0;
+
+       list_for_each_entry_safe(pos, n, &dev->ctxlist, head)
+               if (pos->handle == context) {
+                       context_valid = 1;
+                       break;
+               }
+
+       if (!context_valid)
+               return 0;
 
        via_release_futex(dev_priv, context);
 
@@ -98,7 +109,8 @@
        /* Last context, perform cleanup */
        if (dev->ctx_count == 1 && dev->dev_private) {
                DRM_DEBUG("Last Context\n");
-               drm_irq_uninstall(dev);
+               if (dev->pdev->irq)
+                       drm_irq_uninstall(dev);
                via_cleanup_futex(dev_priv);
                via_do_cleanup_map(dev);
        }

Thanks and Best regards  
=================================================
Bruce C. Chang(張祖明)
VIA Technologies, Inc. 
Address: 1F, 531, Chung-Cheng Road, Hsin-Tien, 231 Taipei
Tel: +886-2-22185452 Ext 7323
Mobile: +886-968343824
Fax: +886-2-22186282
Skype: Bruce.C.Chang
Email: brucech...@via.com.tw
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to