[vbox-dev] [PATCH] additons/linux/drm: Fix NULL pointer dereference kernel oops on kernel 4.10+

Hans de Goede hdegoede at redhat.com
Wed May 17 11:42:33 GMT 2017


The vboxvideo causes a NULL pointer dereference inside the kernel on
kernel 4.10+ when ttm needs to make room in the video memory and tries
to evict things.

This is caused by upstream kernel commit a2ab19fed9d1 ("drm/ttm: make
eviction decision a driver callback v2") introducing a new
eviction_valuable callback which the vboxvideo driver does not define:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=a2ab19fed9d1dc5a7a2ced44f4b289885c522a8f

This commit adds a definition for this callback, fixing the crash.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/VBox/Additions/linux/drm/vbox_ttm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/VBox/Additions/linux/drm/vbox_ttm.c b/src/VBox/Additions/linux/drm/vbox_ttm.c
index 8925191d..95e2c872 100644
--- a/src/VBox/Additions/linux/drm/vbox_ttm.c
+++ b/src/VBox/Additions/linux/drm/vbox_ttm.c
@@ -262,6 +262,9 @@ struct ttm_bo_driver vbox_bo_driver = {
     .ttm_tt_populate = vbox_ttm_tt_populate,
     .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate,
     .init_mem_type = vbox_bo_init_mem_type,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
+    .eviction_valuable = ttm_bo_eviction_valuable,
+#endif
     .evict_flags = vbox_bo_evict_flags,
     .move = vbox_bo_move,
     .verify_access = vbox_bo_verify_access,
-- 
2.12.2




More information about the vbox-dev mailing list