Package: hal Version: 0.5.10-5 Severity: important Tags: patch
hald-addon-input does not release evdev device nodes when a device is removed. Because hald still has the device open the kernel cannot free the device node. After a number of plug/unplug cycles (typically 32) runs out of device nodes, effectively preventing hotplug of USB HID. This is a major issue on systems with USB keyboards/mice that are unplugged on a regular basis, e.g. a laptop or USB hub that is powered off ovenight. When a physical device is removed the destroy_data callback is invoked. This cears the GIOChannel hash table without releasing the channel object. Because the FD is never released the kernel never removes the device, and remove_device is never called. Even if remove_device were called the hash entry has been cleared, so the channel would still not be released. At best this leaks file descriptors, at worst if results in the DoS described above. The attached patch fixes this be releasing the channel object in remove_device. Paul -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.22-3-amd64 (SMP w/2 CPU cores) Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1) Versions of packages hal depends on: ii adduser 3.105 add and remove users and groups ii dbus 1.1.2-1 simple interprocess messaging syst ii hal-info 20071212-2 Hardware Abstraction Layer - fdi f ii libc6 2.7-5 GNU C Library: Shared libraries ii libdbus-1-3 1.1.2-1 simple interprocess messaging syst ii libdbus-glib-1-2 0.74-1 simple interprocess messaging syst ii libexpat1 1.95.8-4 XML parsing C library - runtime li ii libgcc1 1:4.2.2-4 GCC support library ii libglib2.0-0 2.14.4-2 The GLib library of C routines ii libhal-storage1 0.5.10-5 Hardware Abstraction Layer - share ii libhal1 0.5.10-5 Hardware Abstraction Layer - share ii libsmbios1 0.13.10-1 Provide access to (SM)BIOS informa ii libstdc++6 4.2.2-4 The GNU Standard C++ Library v3 ii libusb-0.1-4 2:0.1.12-8 userspace USB programming library ii libvolume-id0 0.114-2 libvolume_id shared library ii lsb-base 3.1-24 Linux Standard Base 3.1 init scrip ii mount 2.13-13 Tools for mounting and manipulatin ii pciutils 1:2.2.4-1.1 Linux PCI Utilities ii pm-utils 0.99.2-3 utilities and scripts for power ma ii udev 0.114-2 /dev/ and hotplug management daemo ii usbutils 0.73-5 Linux USB utilities Versions of packages hal recommends: ii eject 2.1.5-6 ejects CDs and operates CD-Changer ii libsmbios-bin 0.13.10-1 Provide access to (SM)BIOS informa -- no debconf information
diff -ur clean/hald/linux/addons/addon-input.c hal-0.5.10/hald/linux/addons/addon-input.c --- clean/hald/linux/addons/addon-input.c +++ hal-0.5.10/hald/linux/addons/addon-input.c @@ -300,8 +300,14 @@ static void destroy_data (InputData *data) { + GIOChannel *channel; + HAL_DEBUG (("Removing GIOChannel for'%s'", data->udi)); + channel = g_hash_table_lookup(inputs, data->udi); + if (channel) + g_io_channel_unref (channel); + /* Null out the GIOChannel in the hash table, but * leave the key in for DeviceRemoved */