diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2021-11-14 13:28:34 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-11-25 09:48:34 +0100 |
commit | 85f4a563c9e4a2dd7d4e48da224c64232caef1ee (patch) | |
tree | e8a3b8f75e7359aaf0cda8d646d2d444c6b03d91 /net/wireless | |
parent | 0efd57d82ece871da6a783f96235da6ba8c771f5 (diff) | |
download | linux-stable-85f4a563c9e4a2dd7d4e48da224c64232caef1ee.tar.gz linux-stable-85f4a563c9e4a2dd7d4e48da224c64232caef1ee.tar.bz2 linux-stable-85f4a563c9e4a2dd7d4e48da224c64232caef1ee.zip |
tracing: Add length protection to histogram string copies
[ Upstream commit 938aa33f14657c9ed9deea348b7d6f14b6d69cb7 ]
The string copies to the histogram storage has a max size of 256 bytes
(defined by MAX_FILTER_STR_VAL). Only the string size of the event field
needs to be copied to the event storage, but no more than what is in the
event storage. Although nothing should be bigger than 256 bytes, there's
no protection against overwriting of the storage if one day there is.
Copy no more than the destination size, and enforce it.
Also had to turn MAX_FILTER_STR_VAL into an unsigned int, to keep the
min() comparison of the string sizes of comparable types.
Link: https://lore.kernel.org/all/CAHk-=wjREUihCGrtRBwfX47y_KrLCGjiq3t6QtoNJpmVrAEb1w@mail.gmail.com/
Link: https://lkml.kernel.org/r/20211114132834.183429a4@rorschach.local.home
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Tom Zanussi <zanussi@kernel.org>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: 63f84ae6b82b ("tracing/histogram: Do not copy the fixed-size char array field over the field size")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/wireless')
0 files changed, 0 insertions, 0 deletions