diff --git a/SOURCES/0001-lsusb-t-don-t-segfault-when-usbbuslist-is-empty.patch b/SOURCES/0001-lsusb-t-don-t-segfault-when-usbbuslist-is-empty.patch new file mode 100644 index 0000000..99ba91d --- /dev/null +++ b/SOURCES/0001-lsusb-t-don-t-segfault-when-usbbuslist-is-empty.patch @@ -0,0 +1,25 @@ +From f65168f82d6b7795fdd5f2efe3ad10830a87dcbb Mon Sep 17 00:00:00 2001 +From: Lukas Nykryn +Date: Tue, 29 Apr 2014 15:05:05 +0200 +Subject: [PATCH] lsusb-t: don't segfault when usbbuslist is empty + +--- + lsusb-t.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lsusb-t.c b/lsusb-t.c +index 0f2c5bf..a849d4c 100644 +--- a/lsusb-t.c ++++ b/lsusb-t.c +@@ -609,7 +609,7 @@ static void sort_busses(void) + p = usbbuslist; + pp = &usbbuslist; + swapped = 0; +- while (p->next) { ++ while (p && p->next) { + if (p->busnum < p->next->busnum) { + t = p->next; + p->next = t->next; +-- +1.8.3.1 + diff --git a/SOURCES/0001-lsusb-t-handle-problem-if-there-is-no-usb-bus-list.patch b/SOURCES/0001-lsusb-t-handle-problem-if-there-is-no-usb-bus-list.patch new file mode 100644 index 0000000..2ad9f3c --- /dev/null +++ b/SOURCES/0001-lsusb-t-handle-problem-if-there-is-no-usb-bus-list.patch @@ -0,0 +1,31 @@ +From 5211f7bb0bc68764ff34412d3f4fddcfdab99a4c Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Wed, 22 Oct 2014 04:46:52 +0800 +Subject: [PATCH] lsusb-t: handle problem if there is no usb bus list + +Check to see if we really have a list of usb busses before we start +walking it. + +Thanks to Benoit Izac for pointing out the fix. + +Signed-off-by: Greg Kroah-Hartman +--- + lsusb-t.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lsusb-t.c b/lsusb-t.c +index a849d4c..f1fab3b 100644 +--- a/lsusb-t.c ++++ b/lsusb-t.c +@@ -607,6 +607,8 @@ static void sort_busses(void) + int swapped; + do { + p = usbbuslist; ++ if (p == NULL) ++ return; + pp = &usbbuslist; + swapped = 0; + while (p && p->next) { +-- +1.8.3.1 + diff --git a/SPECS/usbutils.spec b/SPECS/usbutils.spec index 8d0d1bb..b89619f 100644 --- a/SPECS/usbutils.spec +++ b/SPECS/usbutils.spec @@ -1,6 +1,6 @@ Name: usbutils Version: 007 -Release: 4%{?dist} +Release: 5%{?dist} Source: https://www.kernel.org/pub/linux/utils/usb/usbutils/%{name}-%{version}.tar.gz URL: http://www.linux-usb.org/ License: GPLv2+ @@ -16,6 +16,9 @@ Conflicts: hotplug < 3:2002_01_14-2 Patch0: usbutils-006-hwdata.patch Patch1: usbutils-007-python2.patch +Patch2: 0001-lsusb-t-don-t-segfault-when-usbbuslist-is-empty.patch +Patch3: 0001-lsusb-t-handle-problem-if-there-is-no-usb-bus-list.patch + %description This package contains utilities for inspecting devices connected to a USB bus. @@ -25,6 +28,9 @@ USB bus. %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 + %build %configure --sbindir=%{_sbindir} --datadir=%{_datadir}/hwdata --disable-usbids make %{?_smp_mflags} @@ -44,6 +50,9 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" rm -rf $RPM_BUILD_ROOT %changelog +* Mon Mar 30 2015 Lukáš Nykrýn - 007-5 +- lsusb -t: fix crashes + * Fri Jan 24 2014 Daniel Mach - 007-4 - Mass rebuild 2014-01-24