Package: bumblebee
Version: 3.2.1-26
Severity: important
Tags: patch upstream
X-Debbugs-Cc: gajdusek.p...@centrum.cz

Dear maintainer,

I own a HP EliteBook 850 G7 with the discrete graphics card having PCI
ID 108 (6c hexa):

$ lspci -vnn | grep '\''[030[02]\]'
00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:9bca] 
(rev 04) (prog-if 00 [VGA controller])
6c:00.0 3D controller [0302]: NVIDIA Corporation GP108M [GeForce MX250] 
[10de:1d13] (rev a1)

Numbers greater then 99 break following snprintf() in src/bbsecondary.c:

  snprintf(pci_id, 12, "PCI:%02d:%02d:%o", pci_bus_id_discrete->bus, ...

As a result, xorg is invoked with truncated value for option
`-isolateDevice <bus-id>`

  Xorg -isolateDevice PCI:109:00:

rather than the correct one

  Xorg -isolateDevice PCI:109:00:0

The Xorg error is:
  (EE) Invalid isolated device specification

Upstream has a fix in their "devel" branch:
https://github.com/Bumblebee-
Project/Bumblebee/commit/44cd9bd71fb4ded05be51f0d653b59a043b31088

Best regards,
Petr
Description: Fix detection of devices on bus numbers larger than 99
Origin: upstream, https://github.com/Bumblebee-Project/Bumblebee/commit/44cd9bd71fb4ded05be51f0d653b59a043b31088

>From 44cd9bd71fb4ded05be51f0d653b59a043b31088 Mon Sep 17 00:00:00 2001
From: Ian Hartwig <ihart...@users.noreply.github.com>
Date: Mon, 15 Apr 2019 20:04:33 -0700
Subject: fix pcie id string overrun

---
 src/bbsecondary.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/bbsecondary.c b/src/bbsecondary.c
index b1e3158..4c07ecb 100644
--- a/src/bbsecondary.c
+++ b/src/bbsecondary.c
@@ -136,9 +136,10 @@ bool start_secondary(bool need_secondary) {
     return true;
   //no problems, start X if not started yet
   if (!bb_is_running(bb_status.x_pid)) {
-    char pci_id[12];
+    char pci_id[13];
     static char *x_conf_file;
-    snprintf(pci_id, 12, "PCI:%02d:%02d:%o", pci_bus_id_discrete->bus,
+    // 0-255 bus, 0-31 slot, 0-7 func
+    snprintf(pci_id, 13, "PCI:%03d:%02d:%o", pci_bus_id_discrete->bus,
             pci_bus_id_discrete->slot, pci_bus_id_discrete->func);
     if (!x_conf_file) {
       x_conf_file = xorg_path_w_driver(bb_config.x_conf_file, bb_config.driver);
-- 
2.30.0

Reply via email to