Commit b4700c0
tracing: ring-buffer: Fix to check event length before using
[ Upstream commit 912b0ee ]
Check the event length before adding it for accessing next index in
rb_read_data_buffer(). Since this function is used for validating
possibly broken ring buffers, the length of the event could be broken.
In that case, the new event (e + len) can point a wrong address.
To avoid invalid memory access at boot, check whether the length of
each event is in the possible range before using it.
Cc: stable@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fixes: 5f3b6e8 ("ring-buffer: Validate boot range memory events")
Link: https://patch.msgid.link/177123421541.142205.9414352170164678966.stgit@devnote2
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 3b91160 commit b4700c0
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1751 | 1751 | | |
1752 | 1752 | | |
1753 | 1753 | | |
| 1754 | + | |
1754 | 1755 | | |
1755 | 1756 | | |
1756 | 1757 | | |
1757 | 1758 | | |
1758 | 1759 | | |
1759 | 1760 | | |
1760 | 1761 | | |
1761 | | - | |
| 1762 | + | |
1762 | 1763 | | |
1763 | 1764 | | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
1764 | 1768 | | |
1765 | 1769 | | |
1766 | 1770 | | |
| |||
0 commit comments