]> git.baikalelectronics.ru Git - kernel.git/commit
usb: early: xhci-dbc: Fix a potential out-of-bound memory access
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 29 Jan 2023 18:23:08 +0000 (19:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:35 +0000 (09:33 +0100)
commit47a4d2007a4bcac10c720d0a3537d1bfa924707e
tree05da7c742834c4a044a42b665d73db63baa1153a
parentaaa423ebde25ff8618027ba602ca5184d3310d7c
usb: early: xhci-dbc: Fix a potential out-of-bound memory access

[ Upstream commit bce18e232037361697f0bc3b21e4b2eb9cb2124a ]

If xdbc_bulk_write() fails, the values in 'buf' can be anything. So the
string is not guaranteed to be NULL terminated when xdbc_trace() is called.

Reserve an extra byte, which will be zeroed automatically because 'buf' is
a static variable, in order to avoid troubles, should it happen.

Fixes: ae326e5dac2d ("usb/early: Add driver for xhci debug capability")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/d6a7562c5e839a195cee85db6dc81817f9372cb1.1675016180.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/early/xhci-dbc.c