]> git.baikalelectronics.ru Git - kernel.git/commit
xhci: Fix invalid loop check in xhci_free_tt_info()
authorTakashi Iwai <tiwai@suse.de>
Fri, 1 Jun 2012 08:06:23 +0000 (10:06 +0200)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Wed, 13 Jun 2012 23:37:28 +0000 (16:37 -0700)
commitcfd6c604e8bb450a855321f084e2aad626e9aba8
tree222dcd651ee6e84e1877da9881f28f4cd91964d0
parent3ade6a583a5244123d459b80d805bcb45d3ae0ce
xhci: Fix invalid loop check in xhci_free_tt_info()

xhci_free_tt_info() may access the invalid memory when it removes the
last entry but the list is not empty.  Then tt_next reaches to the
list head but it still tries to check the tt_info of that entry.

This patch fixes the bug and cleans up the messy code by rewriting
with a simple list_for_each_entry_safe().

This patch should be backported to kernels as old as 3.2, that contain
the commit 2a82167efed092ad62554b5cbf6c2a3540c65b19 "xhci: Store
information about roothubs and TTs."

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reviewed-by: Oliver Neukum <oneukum@suse.de>
Cc: <stable@vger.kernel.org>
drivers/usb/host/xhci-mem.c