mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
perf dso: Set standard errno on decompression failure
dso__get_filename() sets errno to a negative custom DSO_LOAD_ERRNO
value when kernel module decompression fails:
errno = *dso__load_errno(dso); /* e.g. -9996 */
The caller __open_dso() then computes fd = -errno, producing a large
positive value (9996) that looks like a valid file descriptor. This
can cause close_data_fd() to close an unrelated fd used by another
subsystem.
Set errno to EIO instead. The detailed error code is already stored
in dso__load_errno(dso) for diagnostic messages.
Fixes: 1d6b3c9ba7 ("perf tools: Decompress kernel module when reading DSO data")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
5ebf4137d2
commit
1a5f9334a4
|
|
@ -600,7 +600,13 @@ static char *dso__get_filename(struct dso *dso, const char *root_dir,
|
|||
size_t len = sizeof(newpath);
|
||||
|
||||
if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) {
|
||||
errno = *dso__load_errno(dso);
|
||||
/*
|
||||
* Use a standard errno value, not the negative custom
|
||||
* DSO_LOAD_ERRNO stored in dso__load_errno(dso):
|
||||
* __open_dso() computes fd = -errno, so a negative
|
||||
* errno produces a positive fd that looks valid.
|
||||
*/
|
||||
errno = EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user