[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220414110855.774140169@linuxfoundation.org>
Date: Thu, 14 Apr 2022 15:06:47 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Anssi Hannula <anssi.hannula@...wise.fi>,
Mathias Nyman <mathias.nyman@...ux.intel.com>
Subject: [PATCH 5.4 022/475] xhci: fix uninitialized string returned by xhci_decode_ctrl_ctx()
From: Anssi Hannula <anssi.hannula@...wise.fi>
commit 05519b8589a679edb8fa781259893d20bece04ad upstream.
xhci_decode_ctrl_ctx() returns the untouched buffer as-is if both "drop"
and "add" parameters are zero.
Fix the function to return an empty string in that case.
It was not immediately clear from the possible call chains whether this
issue is currently actually triggerable or not.
Note that before commit 4843b4b5ec64 ("xhci: fix even more unsafe memory
usage in xhci tracing") the result effect in the failure case was different
as a static buffer was used here, but the code still worked incorrectly.
Fixes: 90d6d5731da7 ("xhci: Add tracing for input control context")
Cc: stable@...r.kernel.org
Signed-off-by: Anssi Hannula <anssi.hannula@...wise.fi>
Signed-off-by: Mathias Nyman <mathias.nyman@...ux.intel.com>
commit 4843b4b5ec64 ("xhci: fix even more unsafe memory usage in xhci tracing")
Link: https://lore.kernel.org/r/20220303110903.1662404-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/usb/host/xhci.h | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2452,6 +2452,8 @@ static inline const char *xhci_decode_ct
unsigned int bit;
int ret = 0;
+ str[0] = '\0';
+
if (drop) {
ret = sprintf(str, "Drop:");
for_each_set_bit(bit, &drop, 32)
Powered by blists - more mailing lists