diff options
| author | Jiacheng Xu <stitch@zju.edu.cn> | 2026-09-20 13:37:26 +0800 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-09-24 20:21:35 +0200 |
| commit | d516455c940555566642b975d1835c67f08136b3 (patch) | |
| tree | 36dafd9183aad48ea1e1424408e241c0537cfb55 /tools/perf/scripts/python | |
| parent | c15c5befd6d6150e92ab7c6c7fde1088e0f543e6 (diff) | |
| download | linux-next-d516455c940555566642b975d1835c67f08136b3.tar.gz linux-next-d516455c940555566642b975d1835c67f08136b3.zip | |
kobject: fix out-of-bounds access in kobject_action_type()
kobject_action_type() compares the input against each known action
using strncmp() and then indexes the action string using count_first
to check for an exact-length match.
An embedded NUL can make strncmp() return zero even when count_first
exceeds the length of the action string. For example, the five-byte
input "add\0X" makes the parser access kobject_actions[KOBJ_ADD][5],
which is beyond the end of the "add" string.
Check the action string length with strlen() instead of indexing it
with the input-derived offset. This rejects malformed action strings
containing embedded NUL bytes with -EINVAL instead of invoking
undefined behavior.
Cc: stable@kernel.org
Fixes: 60a96a59569b ("Driver core: accept all valid action-strings in uevent-trigger")
Signed-off-by: Jiacheng Xu <stitch@zju.edu.cn>
Reviewed-by: Vishal Moola (Fractile) <vishal.moola@gmail.com>
Link: https://patch.msgid.link/20260920053726.22626-1-stitch@zju.edu.cn
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
