via DRM: Tightened the security for some functions of the
authorThomas Hellstrom <unichrome@shipmail.org>
Tue, 21 Dec 2004 17:13:22 +0000 (17:13 +0000)
committerThomas Hellstrom <unichrome@shipmail.org>
Tue, 21 Dec 2004 17:13:22 +0000 (17:13 +0000)
    DRM_IOCTL_VIA_DMA_INIT IOCTL. Bumped patchlevel and driver date.
XFree86 bug: 2119

shared-core/via_dma.c
shared-core/via_drv.h
shared/via.h
shared/via_dma.c

index ce471a2..cfeb53b 100644 (file)
@@ -191,13 +191,20 @@ int via_dma_init(DRM_IOCTL_ARGS)
 
        switch (init.func) {
        case VIA_INIT_DMA:
-               retcode = via_initialize(dev, dev_priv, &init);
+               if (!capable(CAP_SYS_ADMIN))
+                       retcode = DRM_ERR(EPERM);
+               else
+                       retcode = via_initialize(dev, dev_priv, &init);
                break;
        case VIA_CLEANUP_DMA:
-               retcode = via_dma_cleanup(dev);
+               if (!capable(CAP_SYS_ADMIN))
+                       retcode = DRM_ERR(EPERM);
+               else
+                       retcode = via_dma_cleanup(dev);
                break;
         case VIA_DMA_INITIALIZED:
-               retcode = (dev_priv->ring.virtual_start != NULL) ? 0: DRM_ERR( EFAULT );
+               retcode = (dev_priv->ring.virtual_start != NULL) ? 
+                       0: DRM_ERR( EFAULT );
                break;
        default:
                retcode = DRM_ERR(EINVAL);
index 01d36e4..b2422fc 100644 (file)
 
 #define DRIVER_NAME            "via"
 #define DRIVER_DESC            "VIA Unichrome"
-#define DRIVER_DATE            "20041220"
+#define DRIVER_DATE            "20041221"
 
 #define DRIVER_MAJOR           2
 #define DRIVER_MINOR           3
-#define DRIVER_PATCHLEVEL      2
+#define DRIVER_PATCHLEVEL      3
 
 typedef struct drm_via_ring_buffer {
        drm_map_t map;
index 960f5e2..2811d78 100644 (file)
 
 #define DRIVER_NAME            "via"
 #define DRIVER_DESC            "VIA Unichrome"
-#define DRIVER_DATE            "20041220"
+#define DRIVER_DATE            "20041221"
 
 #define DRIVER_MAJOR           2
 #define DRIVER_MINOR           3
-#define DRIVER_PATCHLEVEL      2
+#define DRIVER_PATCHLEVEL      3
 
 #define DRIVER_IOCTLS                                                  \
         [DRM_IOCTL_NR(DRM_IOCTL_VIA_ALLOCMEM)]  = { via_mem_alloc,  1, 0 }, \
index a5c4b0a..000d4b0 100644 (file)
@@ -192,13 +192,20 @@ int via_dma_init(DRM_IOCTL_ARGS)
 
        switch (init.func) {
        case VIA_INIT_DMA:
-               retcode = via_initialize(dev, dev_priv, &init);
+               if (!capable(CAP_SYS_ADMIN))
+                       retcode = DRM_ERR(EPERM);
+               else
+                       retcode = via_initialize(dev, dev_priv, &init);
                break;
        case VIA_CLEANUP_DMA:
-               retcode = via_dma_cleanup(dev);
+               if (!capable(CAP_SYS_ADMIN))
+                       retcode = DRM_ERR(EPERM);
+               else
+                       retcode = via_dma_cleanup(dev);
                break;
         case VIA_DMA_INITIALIZED:
-               retcode = (dev_priv->ring.virtual_start != NULL) ? 0: DRM_ERR( EFAULT );
+               retcode = (dev_priv->ring.virtual_start != NULL) ? 
+                       0: DRM_ERR( EFAULT );
                break;
        default:
                retcode = DRM_ERR(EINVAL);