diff options
author | Song Liu <songliubraving@fb.com> | 2021-10-03 22:32:38 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-11-02 19:46:15 +0100 |
commit | 39fb393e21021eefce076c5d99efe66399d126e2 (patch) | |
tree | 699f579065de2d23dbe2fe0477354edeecf0ec53 /crypto/seed.c | |
parent | 472d9354a9ce846828de5b33e70dbc5ff81c2ee1 (diff) |
perf script: Check session->header.env.arch before using it
commit 29c77550eef31b0d72a45b49eeab03b8963264e8 upstream.
When perf.data is not written cleanly, we would like to process existing
data as much as possible (please see f_header.data.size == 0 condition
in perf_session__read_header). However, perf.data with partial data may
crash perf. Specifically, we see crash in 'perf script' for NULL
session->header.env.arch.
Fix this by checking session->header.env.arch before using it to determine
native_arch. Also split the if condition so it is easier to read.
Committer notes:
If it is a pipe, we already assume is a native arch, so no need to check
session->header.env.arch.
Signed-off-by: Song Liu <songliubraving@fb.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-team@fb.com
Cc: stable@vger.kernel.org
Link: http://lore.kernel.org/lkml/20211004053238.514936-1-songliubraving@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'crypto/seed.c')
0 files changed, 0 insertions, 0 deletions