DragonFlyBSD Kernel Audit
DF-1511 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/video/vga/vga_switcheroo.c b/sys/dev/video/vga/vga_switcheroo.c
--- a/sys/dev/video/vga/vga_switcheroo.c
+++ b/sys/dev/video/vga/vga_switcheroo.c
@@ -1229,6 +1229,11 @@
 	int ret;
 
 	mutex_lock(&vgasr_priv->mux_hw_lk);
+	if (vgasr_priv->handler == NULL ||
+	    vgasr_priv->handler->switchto == NULL) {
+		mutex_unlock(&vgasr_priv->mux_hw_lk);
+		return -ENODEV;
+	}
 	ret = vgasr_priv->handler->switchto(client_id);
 	mutex_unlock(&vgasr_priv->mux_hw_lk);
 	if (ret)