Re: [PATCH 2/5] perf dso: Guard close() against invalid fd in dso__decompress_kmodule_path()

[email protected]
Newsgroups org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
> From: Arnaldo Carvalho de Melo <[email protected]>
> 
> dso__decompress_kmodule_path() unconditionally calls close(fd) on the
> return value of decompress_kmodule().  When decompression fails or the
> DSO is not compressed, decompress_kmodule() returns -1.  close(-1)
> fails with EBADF and clobbers errno, which callers up the chain
> (dso__get_filename → __open_dso) depend on for error propagation.
> 
> Guard the close() call with fd >= 0 so only valid file descriptors are
> closed.
> 
> Fixes: 42b3fa670825 ("perf tools: Introduce dso__decompress_kmodule_{fd,path}")
> Reported-by: sashiko-bot <[email protected]>
> Reviewed-by: Ian Rogers <[email protected]>
> Cc: Namhyung Kim <[email protected]>
> Assisted-by: Claude:claude-opus-4.6
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.