From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Wei Li <liwei391@huawei.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>,
Hanjun Guo <guohanjun@huawei.com>,
Jin Yao <yao.jin@linux.intel.com>,
Mark Rutland <mark.rutland@arm.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.4 048/109] perf report TUI: Fix segmentation fault in perf_evsel__hists_browse()
Date: Tue, 14 Jul 2020 20:43:51 +0200 [thread overview]
Message-ID: <20200714184107.821720203@linuxfoundation.org> (raw)
In-Reply-To: <20200714184105.507384017@linuxfoundation.org>
From: Wei Li <liwei391@huawei.com>
[ Upstream commit d61cbb859b45fdb6b4997f2d51834fae41af0e94 ]
The segmentation fault can be reproduced as following steps:
1) Executing perf report in tui.
2) Typing '/xxxxx' to filter the symbol to get nothing matched.
3) Pressing enter with no entry selected.
Then it will report a segmentation fault.
It is caused by the lack of check of browser->he_selection when
accessing it's member res_samples in perf_evsel__hists_browse().
These processes are meaningful for specified samples, so we can skip
these when nothing is selected.
Fixes: 4968ac8fb7c3 ("perf report: Implement browsing of individual samples")
Signed-off-by: Wei Li <liwei391@huawei.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Link: http://lore.kernel.org/lkml/20200612094322.39565-1-liwei391@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/ui/browsers/hists.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 88c3df24b748c..514cef3a17b40 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2224,6 +2224,11 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browser
return browser->he_selection->thread;
}
+static struct res_sample *hist_browser__selected_res_sample(struct hist_browser *browser)
+{
+ return browser->he_selection ? browser->he_selection->res_samples : NULL;
+}
+
/* Check whether the browser is for 'top' or 'report' */
static inline bool is_report_browser(void *timer)
{
@@ -3170,16 +3175,16 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,
&options[nr_options], NULL, NULL, evsel);
nr_options += add_res_sample_opt(browser, &actions[nr_options],
&options[nr_options],
- hist_browser__selected_entry(browser)->res_samples,
- evsel, A_NORMAL);
+ hist_browser__selected_res_sample(browser),
+ evsel, A_NORMAL);
nr_options += add_res_sample_opt(browser, &actions[nr_options],
&options[nr_options],
- hist_browser__selected_entry(browser)->res_samples,
- evsel, A_ASM);
+ hist_browser__selected_res_sample(browser),
+ evsel, A_ASM);
nr_options += add_res_sample_opt(browser, &actions[nr_options],
&options[nr_options],
- hist_browser__selected_entry(browser)->res_samples,
- evsel, A_SOURCE);
+ hist_browser__selected_res_sample(browser),
+ evsel, A_SOURCE);
nr_options += add_switch_opt(browser, &actions[nr_options],
&options[nr_options]);
skip_scripting:
--
2.25.1
next prev parent reply other threads:[~2020-07-14 19:07 UTC|newest]
Thread overview: 122+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 18:42 [PATCH 5.4 000/109] 5.4.52-rc1 review Greg Kroah-Hartman
2020-07-14 18:42 ` [PATCH 5.4 004/109] regmap: fix alignment issue Greg Kroah-Hartman
2020-07-14 18:43 ` Greg Kroah-Hartman
2020-07-14 18:42 ` [PATCH 5.4 005/109] perf/x86/rapl: Move RAPL support to common x86 code Greg Kroah-Hartman
2020-07-14 18:43 ` Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 000/109] 5.4.52-rc1 review Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 001/109] KVM: s390: reduce number of IO pins to 1 Greg Kroah-Hartman
2020-07-14 18:42 ` Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 002/109] spi: spi-fsl-dspi: Adding shutdown hook Greg Kroah-Hartman
2020-07-14 18:42 ` Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 003/109] spi: spi-fsl-dspi: Fix lockup if device is removed during SPI transfer Greg Kroah-Hartman
2020-07-14 18:42 ` Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 006/109] perf/x86/rapl: Fix RAPL config variable bug Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 007/109] ARM: dts: omap4-droid4: Fix spi configuration and increase rate Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 008/109] drm/ttm: Fix dma_fence refcnt leak when adding move fence Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 009/109] drm/tegra: hub: Do not enable orphaned window group Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 010/109] gpu: host1x: Detach driver on unregister Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 011/109] drm: mcde: Fix display initialization problem Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 012/109] ASoC: SOF: Intel: add PCI ID for CometLake-S Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 013/109] ALSA: hda: Intel: add missing PCI IDs for ICL-H, TGL-H and EKL Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 014/109] spi: spidev: fix a race between spidev_release and spidev_remove Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 015/109] spi: spidev: fix a potential use-after-free in spidev_release() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 016/109] net: ethernet: mvneta: Fix Serdes configuration for SoCs without comphy Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 017/109] net: ethernet: mvneta: Add 2500BaseX support " Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 018/109] ixgbe: protect ring accesses with READ- and WRITE_ONCE Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 019/109] i40e: " Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 020/109] ibmvnic: continue to init in CRQ reset returns H_CLOSED Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 021/109] powerpc/kvm/book3s64: Fix kernel crash with nested kvm & DEBUG_VIRTUAL Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 022/109] iommu/vt-d: Dont apply gfx quirks to untrusted devices Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 023/109] drm: panel-orientation-quirks: Add quirk for Asus T101HA panel Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 024/109] drm: panel-orientation-quirks: Use generic orientation-data for Acer S1003 Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 025/109] s390/kasan: fix early pgm check handler execution Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 026/109] drm/sun4i: mixer: Call of_dma_configure if theres an IOMMU Greg Kroah-Hartman
2020-07-15 2:22 ` Chen-Yu Tsai
2020-07-15 9:24 ` Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 027/109] cifs: update ctime and mtime during truncate Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 028/109] ARM: imx6: add missing put_device() call in imx6q_suspend_init() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 029/109] scsi: mptscsih: Fix read sense data size Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 030/109] usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 031/109] block: release bip in a right way in error path Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 032/109] nvme-rdma: assign completion vector correctly Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 033/109] x86/entry: Increase entry_stack size to a full page Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 034/109] sched/core: Check cpus_mask, not cpus_ptr in __set_cpus_allowed_ptr(), to fix mask corruption Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 035/109] net: qrtr: Fix an out of bounds read qrtr_endpoint_post() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 036/109] gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2 Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 037/109] gpio: pca953x: Fix GPIO resource leak on Intel " Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 038/109] nl80211: dont return err unconditionally in nl80211_start_ap() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 039/109] drm/mediatek: Check plane visibility in atomic_update Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 040/109] bpf, sockmap: RCU splat with redirect and strparser error or TLS Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 041/109] bpf, sockmap: RCU dereferenced psock may be used outside RCU block Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 042/109] netfilter: ipset: call ip_set_free() instead of kfree() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 043/109] net: mvneta: fix use of state->speed Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 044/109] net: cxgb4: fix return error value in t4_prep_fw Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 045/109] IB/sa: Resolv use-after-free in ib_nl_make_request() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 046/109] net: dsa: microchip: set the correct number of ports Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 047/109] netfilter: conntrack: refetch conntrack after nf_conntrack_update() Greg Kroah-Hartman
2020-07-14 18:43 ` Greg Kroah-Hartman [this message]
2020-07-14 18:43 ` [PATCH 5.4 049/109] perf intel-pt: Fix recording PEBS-via-PT with registers Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 050/109] perf intel-pt: Fix PEBS sample for XMM registers Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 051/109] smsc95xx: check return value of smsc95xx_reset Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 052/109] smsc95xx: avoid memory leak in smsc95xx_bind Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 053/109] net: hns3: add a missing uninit debugfs when unload driver Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 054/109] net: hns3: fix use-after-free when doing self test Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 055/109] ALSA: compress: fix partial_drain completion state Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 5.4 056/109] RDMA/siw: Fix reporting vendor_part_id Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 057/109] arm64: kgdb: Fix single-step exception handling oops Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 058/109] nbd: Fix memory leak in nbd_add_socket Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 059/109] cxgb4: fix all-mask IP address comparison Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 060/109] IB/mlx5: Fix 50G per lane indication Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 061/109] qed: Populate nvm-file attributes while reading nvm config partition Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 062/109] net/mlx5: Fix eeprom support for SFP module Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 063/109] net/mlx5e: Fix 50G per lane indication Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 064/109] bnxt_en: fix NULL dereference in case SR-IOV configuration fails Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 065/109] net: macb: fix wakeup test in runtime suspend/resume routines Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 066/109] net: macb: mark device wake capable when "magic-packet" property present Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 067/109] net: macb: fix call to pm_runtime in the suspend/resume functions Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 068/109] mlxsw: spectrum_router: Remove inappropriate usage of WARN_ON() Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 069/109] mlxsw: pci: Fix use-after-free in case of failed devlink reload Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 070/109] IB/hfi1: Do not destroy hfi1_wq when the device is shut down Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 071/109] IB/hfi1: Do not destroy link_wq " Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 072/109] ALSA: opl3: fix infoleak in opl3 Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 073/109] ALSA: hda - let hs_mic be picked ahead of hp_mic Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 074/109] ALSA: usb-audio: add quirk for MacroSilicon MS2109 Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 075/109] ALSA: usb-audio: Add implicit feedback quirk for RTX6001 Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 076/109] ALSA: hda/realtek - Fix Lenovo Thinkpad X1 Carbon 7th quirk subdevice id Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 077/109] ALSA: hda/realtek - Enable audio jacks of Acer vCopperbox with ALC269VC Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 078/109] ALSA: hda/realtek: Enable headset mic of Acer C20-820 " Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 079/109] ALSA: hda/realtek: Enable headset mic of Acer Veriton N4660G " Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 080/109] KVM: arm64: Fix definition of PAGE_HYP_DEVICE Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 081/109] KVM: arm64: Stop clobbering x0 for HVC_SOFT_RESTART Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 082/109] KVM: arm64: Annotate hyp NMI-related functions as __always_inline Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 083/109] KVM: x86: bit 8 of non-leaf PDPEs is not reserved Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 084/109] KVM: x86: Inject #GP if guest attempts to toggle CR4.LA57 in 64-bit mode Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 085/109] KVM: x86: Mark CR4.TSD as being possibly owned by the guest Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 086/109] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect with SVE Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 087/109] kallsyms: Refactor kallsyms_show_value() to take cred Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 088/109] module: Refactor section attr into bin attribute Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 089/109] module: Do not expose section addresses to non-CAP_SYSLOG Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 090/109] kprobes: Do not expose probe " Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 091/109] bpf: Check correct cred for CAP_SYSLOG in bpf_dump_raw_ok() Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 092/109] Revert "ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb" Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 093/109] btrfs: fix fatal extent_buffer readahead vs releasepage race Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 094/109] btrfs: fix double put of block group with nocow Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 095/109] drm/radeon: fix double free Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 096/109] drm/amdgpu: dont do soft recovery if gpu_recovery=0 Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 097/109] dm: use noio when sending kobject event Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 098/109] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 099/109] ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 100/109] ARC: elf: use right ELF_ARCH Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 101/109] s390/setup: init jump labels before command line parsing Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 102/109] s390/mm: fix huge pte soft dirty copying Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 103/109] blk-mq: consider non-idle request as "inflight" in blk_mq_rq_inflight() Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 104/109] dm writecache: reject asynchronous pmem devices Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 105/109] perf scripts python: export-to-postgresql.py: Fix struct.pack() int argument Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 106/109] perf scripts python: exported-sql-viewer.py: Fix zero id in call graph Find result Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 107/109] perf scripts python: exported-sql-viewer.py: Fix zero id in call tree " Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 108/109] perf scripts python: exported-sql-viewer.py: Fix unexpanded " Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 5.4 109/109] pwm: jz4740: Fix build failure Greg Kroah-Hartman
2020-07-15 6:21 ` [PATCH 5.4 000/109] 5.4.52-rc1 review Naresh Kamboju
2020-07-15 10:50 ` Jon Hunter
2020-07-15 15:18 ` Shuah Khan
2020-07-15 16:43 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200714184107.821720203@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=guohanjun@huawei.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liwei391@huawei.com \
--cc=mark.rutland@arm.com \
--cc=namhyung@kernel.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=yao.jin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).