lsdvb crashes if device is in use

Bug #2130961 reported by Daniel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linuxtv-dvb-apps (Ubuntu)
New
Undecided
Unassigned

Bug Description

lsdvb crashes if the device is in use (for example by tvheadend). Problem is the file mode. `O_RDWR` is not needed, `O_RDONLY` is enough.

Original output (actual):
```
$ lsdvb

                lsdvb: Simple utility to list PCI/PCIe DVB devices
                Version: 0.0.4
                Copyright (C) Manu Abraham

em28xx (632515409:0 0:1) on PCI Domain:31888 Bus:-818575984 Device:31888 Function:-818390219
        DEVICE:0 ADAPTER:0 ERROR: Open frontend0 failed
```

Expected output (with patch):
```
$ lsdvb

                lsdvb: Simple utility to list PCI/PCIe DVB devices
                Version: 0.0.4
                Copyright (C) Manu Abraham

em28xx (-633244093:0 0:1) on PCI Domain:32354 Bus:-2121079408 Device:32354 Function:-2120893643
        DEVICE:0 ADAPTER:0 FRONTEND:0 (Silicon Labs Si2168)
                 FE_QAM Fmin=48MHz Fmax=870MHz
        DEVICE:0 ADAPTER:1 FRONTEND:0 (Silicon Labs Si2168)
                 FE_QAM Fmin=48MHz Fmax=870MHz
```

patch:
```
--- linuxtv-dvb-apps-1.1.1+rev1500/util/lsdvb/lsdvb.c_orig 2025-11-08 23:01:10.000484848 +0000
+++ linuxtv-dvb-apps-1.1.1+rev1500/util/lsdvb/lsdvb.c 2025-11-08 23:04:33.941737821 +0000
@@ -290,7 +290,7 @@

    get_frontend_info(adapter, frontend);
    sprintf(fedev, "%s/adapter%d/%s", DVB_DIR, adapter, frontend);
- fd = open(fedev, O_RDWR | O_NONBLOCK);
+ fd = open(fedev, O_RDONLY | O_NONBLOCK);
    if (fd < 0) {
     fprintf(stderr, "ERROR: Open %s failed\n", frontend);
     return -1;

```

Ubuntu 24.04,

Package: dvb-apps
Architecture: amd64
Version: 1.1.1+rev1500-1.4build3

Revision history for this message
Daniel (hackie) wrote :

btw the pci device information also looks weird (note the big and negative numbers). in my case, its two usb devices with the same driver

Revision history for this message
Daniel (hackie) wrote :
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.