Commit 6388400b authored by Mathias Nyman's avatar Mathias Nyman Committed by Lee Jones
Browse files

UPSTREAM: xhci: Fix incorrect tracking of free space on transfer rings



This incorrect tracking caused unnecessary ring expansion in some
usecases which over days of use consume a lot of memory.

xhci driver tries to keep track of free transfer blocks (TRBs) on the
ring buffer, but failed to add back some cancelled transfers that were
turned into no-op operations instead of just moving past them.

This can happen if there are several queued pending transfers which
then are cancelled in reverse order.

Solve this by counting the numer of steps we move the dequeue pointer
once we complete a transfer, and add it to the number of free trbs
instead of just adding the trb number of the current transfer.
This way we ensure we count the no-op trbs on the way as well.

Bug: 254441685
Fixes: 55f6153d ("xhci: remove extra loop in interrupt context")
Cc: stable@vger.kernel.org
Reported-by: default avatarMiller Hunter <MillerH@hearthnhome.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217242


Tested-by: default avatarMiller Hunter <MillerH@hearthnhome.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20230515134059.161110-3-mathias.nyman@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit fe82f16a)
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: Iba6c2cfad83029fcd567b5064f8ce80ccda0a701
parent bc78acae
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment