char/agp: Disable frontend without CONFIG_DRM_LEGACY
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 17 Nov 2020 21:40:29 +0000 (22:40 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 18 Nov 2020 21:47:45 +0000 (22:47 +0100)
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
drivers/char/agp/Makefile
drivers/char/agp/agp.h

index cb2497d157f613046f420f08a5c7d4059d819489..90ed8c789e4824fbca21c028dad52b008b1b257c 100644 (file)
@@ -1,7 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
-agpgart-y := backend.o frontend.o generic.o isoch.o
+agpgart-y := backend.o generic.o isoch.o
 
+ifeq ($(CONFIG_DRM_LEGACY),y)
 agpgart-$(CONFIG_COMPAT)       += compat_ioctl.o
+agpgart-y                      += frontend.o
+endif
+
 
 obj-$(CONFIG_AGP)              += agpgart.o
 obj-$(CONFIG_AGP_ALI)          += ali-agp.o
index 4eb1c772ded702406850d93488f0b293c96ac317..bb09d64cd51e9998eba6f7ab28e89ab5de49faa8 100644 (file)
@@ -186,8 +186,13 @@ int agp_add_bridge(struct agp_bridge_data *bridge);
 void agp_remove_bridge(struct agp_bridge_data *bridge);
 
 /* Frontend routines. */
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
 int agp_frontend_initialize(void);
 void agp_frontend_cleanup(void);
+#else
+static inline int agp_frontend_initialize(void) { return 0; }
+static inline void agp_frontend_cleanup(void) {}
+#endif
 
 /* Generic routines. */
 void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);