lsusb-t: make sure that interfaces are added to lists only once (#914929)

This commit is contained in:
Lukas Nykryn 2013-02-26 15:03:01 +01:00
parent b0a0086593
commit 32eb76963e
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,34 @@
diff --git a/lsusb-t.c b/lsusb-t.c
index 074dafb..3e29072 100644
--- a/lsusb-t.c
+++ b/lsusb-t.c
@@ -210,8 +210,13 @@ static void read_sysfs_file_string(const char *d_name, const char *file, char *b
static void append_dev_interface(struct usbinterface *i, struct usbinterface *new)
{
- while (i->next)
+ while (i->next) {
+ if (i == new)
+ return;
i = i->next;
+ }
+ if (i == new)
+ return;
i->next = new;
}
@@ -230,8 +235,13 @@ static void append_businterface(unsigned int busnum, struct usbinterface *new)
if (b->busnum == busnum) {
i = b->first_interface;
if (i) {
- while (i->next)
+ while (i->next) {
+ if (i == new)
+ return;
i = i->next;
+ }
+ if (i == new)
+ return;
i->next = new;
} else
b->first_interface = new;

View File

@ -1,6 +1,6 @@
Name: usbutils
Version: 006
Release: 3%{?dist}
Release: 4%{?dist}
Source: %{name}-%{version}.tar.gz
URL: http://www.linux-usb.org/
License: GPLv2+
@ -14,6 +14,7 @@ Conflicts: hotplug < 3:2002_01_14-2
#Path to usb.ids in lsusb.py should be with /hwdata/
Patch0: usbutils-006-hwdata.patch
Patch1: usbutils-006-lsub-t_loop.patch
%description
This package contains utilities for inspecting devices connected to a
@ -22,6 +23,7 @@ USB bus.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
./autogen.sh
%build
@ -43,6 +45,9 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Feb 26 2013 Lukáš Nykrýn <lnykryn@redhat.com> - 006-4
- lsusb-t: make sure that interfaces are added to lists only once (#914929)
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 006-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild