diff -Nurp fglrx-installer-8.723.1/lib/modules/fglrx/build_mod/2.6.x/Makefile fglrx-installer-8.723.1.new/lib/modules/fglrx/build_mod/2.6.x/Makefile --- fglrx-installer-8.723.1/lib/modules/fglrx/build_mod/2.6.x/Makefile 2010-04-09 20:21:39.000000000 +0200 +++ fglrx-installer-8.723.1.new/lib/modules/fglrx/build_mod/2.6.x/Makefile 2010-09-20 14:44:11.026471782 +0200 @@ -67,6 +67,10 @@ EXTRA_CFLAGS += \ -DFGL_LINUX253P1_VMA_API \ -DPAGE_ATTR_FIX=$(PAGE_ATTR_FIX) \ +ifeq ($(shell grep -q "T compat_alloc_user_space" /proc/kallsyms && echo 1),1) + EXTRA_CFLAGS += -DFGL_USE_ARCH_COMPAT_ALLOC_USER_SPACE +endif + ifeq ($(KERNELRELEASE),) # on first call from remote location we get into this path # whilst on second call all is managed by the embedding kernel makefile diff -Nurp fglrx-installer-8.723.1/lib/modules/fglrx/build_mod/kcl_ioctl.c fglrx-installer-8.723.1.new/lib/modules/fglrx/build_mod/kcl_ioctl.c --- fglrx-installer-8.723.1/lib/modules/fglrx/build_mod/kcl_ioctl.c 2010-04-09 20:21:39.000000000 +0200 +++ fglrx-installer-8.723.1.new/lib/modules/fglrx/build_mod/kcl_ioctl.c 2010-09-20 14:53:32.676471518 +0200 @@ -193,7 +193,22 @@ void ATI_API_CALL KCL_IOCTL_UnregisterCo */ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size) { - return compat_alloc_user_space(size); + void *ptr; + + /* If len would occupy more than half of the entire compat space... */ + if (unlikely(((unsigned long) size) > (((compat_uptr_t)~0) >> 1))) + return NULL; + +#ifdef FGL_USE_ARCH_COMPAT_ALLOC_USER_SPACE + ptr = arch_compat_alloc_user_space(size); +#else + ptr = compat_alloc_user_space(size); +#endif + + if (unlikely(!access_ok(VERIFY_WRITE, ptr, size))) + return NULL; + + return ptr; } #endif // __x86_64__