Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

lsusb-t: make sure that interfaces are added to lists only once #15

Merged
merged 1 commit into from

2 participants

lnykryn Greg Kroah-Hartman
lnykryn

In some cases interfaces are added multiple times to the lists, which leads to infinite loops during output.
https://bugzilla.redhat.com/show_bug.cgi?id=914929

Greg Kroah-Hartman gregkh merged commit 3d28197 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 2 deletions.
  1. +12 −2 lsusb-t.c
14 lsusb-t.c
View
@@ -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;
Something went wrong with that request. Please try again.