diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-06-11 02:40:34 +0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-06-17 14:28:47 +0300 |
| commit | cfafef390ca9c753b34c7e97b5abee4cab0ce270 (patch) | |
| tree | 96e5cc144112aac4f6e63fcc7d383f4562f187eb /scripts/Makefile.thinlto | |
| parent | 7b0df6f4d498b1608afccfd6dffb264e6da91693 (diff) | |
| download | linux-cfafef390ca9c753b34c7e97b5abee4cab0ce270.tar.xz | |
perf hwmon: Fix fd check to accept fd 0 in hwmon_pmu__describe_items()
hwmon_pmu__describe_items() checks 'if (fd > 0)' after openat(), which
incorrectly rejects fd 0. While fd 0 is normally stdin, if stdin has
been closed (common in daemon/service contexts), the kernel reuses fd 0
for the next open. With fd > 0, the sysfs file is not read and the fd
is leaked.
Change to 'if (fd >= 0)' to match the standard openat() error check.
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Fixes: 53cc0b351ec99278 ("perf hwmon_pmu: Add a tool PMU exposing events from hwmon in sysfs")
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Ian Rogers <irogers@google.com>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
