]> git.itanic.dy.fi Git - linux-stable/commit
kdb: Fix pager search for multi-line strings
authorDaniel Thompson <daniel.thompson@linaro.org>
Wed, 9 Sep 2020 14:17:08 +0000 (15:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:03:06 +0000 (09:03 +0100)
commita7c1b557e687f21c5bf1d81b8fb46ce376adc93e
tree8333f52cb56ac2af8fa78832a0e2f56dd4d3675d
parent4d1df9a290fe0a6f6b1c9d29705b37b934e26848
kdb: Fix pager search for multi-line strings

[ Upstream commit d081a6e353168f15e63eb9e9334757f20343319f ]

Currently using forward search doesn't handle multi-line strings correctly.
The search routine replaces line breaks with \0 during the search and, for
regular searches ("help | grep Common\n"), there is code after the line
has been discarded or printed to replace the break character.

However during a pager search ("help\n" followed by "/Common\n") when the
string is matched we will immediately return to normal output and the code
that should restore the \n becomes unreachable. Fix this by restoring the
replaced character when we disable the search mode and update the comment
accordingly.

Fixes: fb6daa7520f9d ("kdb: Provide forward search at more prompt")
Link: https://lore.kernel.org/r/20200909141708.338273-1-daniel.thompson@linaro.org
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/debug/kdb/kdb_io.c