2.4.36-stable kernel tree
Revision | 5dceef59f2919d7396853e4264636e3bd55f85e7 (tree) |
---|---|
Zeit | 2006-03-12 06:49:33 |
Autor | Marin Mitov <mitov@issp...> |
Commiter | Marcelo Tosatti |
[PATCH] DRM: drm_stub_open() range checking
This patch corrects a bug in drm driver by forcing
its minor number in the limits of the allocated
resources: DRM(stub_list)[DRM_STUB_MAXCARDS]
Manifestation: Xorg-6.9.0 SIGSEGFAULTs when the
loading of dri module is enabled (direct rendering)
Xorg-6.9.0 (and evidently not the previous versions)
has defined DRM_MAX_MINOR as 255 (and Xorg-6.9.0
tries to open all of them) while in the kernel:
DRM_STUB_MAXCARDS is defined as 16.
@@ -52,6 +52,7 @@ static int DRM(stub_open)(struct inode *inode, struct file *filp) | ||
52 | 52 | int err = -ENODEV; |
53 | 53 | struct file_operations *old_fops; |
54 | 54 | |
55 | + if (minor < 0 || minor >=DRM_STUB_MAXCARDS) return -ENODEV; | |
55 | 56 | if (!DRM(stub_list) || !DRM(stub_list)[minor].fops) return -ENODEV; |
56 | 57 | old_fops = filp->f_op; |
57 | 58 | filp->f_op = fops_get(DRM(stub_list)[minor].fops); |