Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

char/agp: Disable frontend without CONFIG_DRM_LEGACY

It's probably full of bugs ready for exploiting by userspace. And
there's not going to be any userspace for this without any of the drm
legacy drivers enabled too. So just couple it together.

Note that the frontend is only the /dev/agp ioctl interface, which per
Adam is only used by the i810 userspace drivers. All other drivers go
through the drm bufmap agp handling abstraction apparently.

v2: Augment commit message a bit from m-l feedback.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Adam Jackson <ajax@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117214029.591896-1-daniel.vetter@ffwll.ch

+10 -1
+5 -1
drivers/char/agp/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - agpgart-y := backend.o frontend.o generic.o isoch.o 2 + agpgart-y := backend.o generic.o isoch.o 3 3 4 + ifeq ($(CONFIG_DRM_LEGACY),y) 4 5 agpgart-$(CONFIG_COMPAT) += compat_ioctl.o 6 + agpgart-y += frontend.o 7 + endif 8 + 5 9 6 10 obj-$(CONFIG_AGP) += agpgart.o 7 11 obj-$(CONFIG_AGP_ALI) += ali-agp.o
+5
drivers/char/agp/agp.h
··· 186 186 void agp_remove_bridge(struct agp_bridge_data *bridge); 187 187 188 188 /* Frontend routines. */ 189 + #if IS_ENABLED(CONFIG_DRM_LEGACY) 189 190 int agp_frontend_initialize(void); 190 191 void agp_frontend_cleanup(void); 192 + #else 193 + static inline int agp_frontend_initialize(void) { return 0; } 194 + static inline void agp_frontend_cleanup(void) {} 195 + #endif 191 196 192 197 /* Generic routines. */ 193 198 void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);