reassign 1114853 libpciaccess0 tags 1114853 +patch thanks Dear libpciaccess0 maintainers,
I've been using the attached patch from upstream, with a locally recompiled package, to avoid the NULL pointer derefence in libpciaccess0 on Debian 13.5 Xfce on my old netbook, for the past 5 weeks, with no side effects. Could you please include the patch in the next point release of Debian Stable? Many thanks in advance, Laurentiu
commit 0b8b5f2c4632e5e0204acfd2ea892220bd8db606 Author: Vitaliy Filippov <[email protected]> Date: Sun Sep 14 03:39:10 2014 +0400 Make pci_system_{init,cleanup} use reference counting to prevent pci_sys from being NULL when those functions are called multiple times. Originally from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=761445 and https://bugs.freedesktop.org/show_bug.cgi?id=84325 Closes: #6 Closes: #25 Part-of: <https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/merge_requests/43> diff --git a/src/common_init.c b/src/common_init.c index 1004038..9cd7fb4 100644 --- a/src/common_init.c +++ b/src/common_init.c @@ -39,6 +39,7 @@ #include "pciaccess_private.h" _pci_hidden struct pci_system * pci_sys; +static int pci_sys_refcnt = 0; /** * Initialize the PCI subsystem for access. @@ -55,6 +56,11 @@ pci_system_init( void ) { int err = ENOSYS; + if ( pci_sys_refcnt > 0 ) { + pci_sys_refcnt++; + return 0; + } + #ifdef __linux__ err = pci_system_linux_sysfs_create(); #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) @@ -73,6 +79,10 @@ pci_system_init( void ) # error "Unsupported OS" #endif + if ( pci_sys != NULL ) { + pci_sys_refcnt = 1; + } + return err; } @@ -100,6 +110,11 @@ pci_system_cleanup( void ) return; } + if ( pci_sys_refcnt > 1 ) { + pci_sys_refcnt--; + return; + } + pci_io_cleanup(); if ( pci_sys->devices ) { @@ -130,4 +145,5 @@ pci_system_cleanup( void ) free( pci_sys ); pci_sys = NULL; + pci_sys_refcnt = 0; }

