Commit e60f5f66 authored by Pietro Borrello's avatar Pietro Borrello Committed by sanglipeng
Browse files

tracing/probe: trace_probe_primary_from_call(): checked list_first_entry

stable inclusion
from stable-v5.10.183
commit 57eb824b8cbb29156fb352153e18a91ac2ed0daa
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8IRR2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=57eb824b8cbb29156fb352153e18a91ac2ed0daa

--------------------------------

commit 81d0fa4c upstream.

All callers of trace_probe_primary_from_call() check the return
value to be non NULL. However, the function returns
list_first_entry(&tpe->probes, ...) which can never be NULL.
Additionally, it does not check for the list being possibly empty,
possibly causing a type confusion on empty lists.
Use list_first_entry_or_null() which solves both problems.

Link: https://lore.kernel.org/linux-trace-kernel/20230128-list-entry-null-check-v1-1-8bde6a3da2ef@diag.uniroma1.it/



Fixes: 60d53e2c ("tracing/probe: Split trace_event related data from trace_probe")
Signed-off-by: default avatarPietro Borrello <borrello@diag.uniroma1.it>
Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: default avatarMukesh Ojha <quic_mojha@quicinc.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 78ebe595
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment