Re: [PATCH v2] modpost: prevent leak when early return no suffix .o in read_symbols()

From: Nathan Chancellor

Date: Mon Jun 29 2026 - 22:34:14 EST


On Wed, 24 Jun 2026 11:47:42 +0700, Robertus Diawan Chris <robertusdchris@xxxxxxxxx> wrote:
> The allocation for elf info symsearch and hdr from parse_elf() haven't
> been released when return because of modname didn't have suffix ".o".
> And it seems like the suffix ".o" check did not depends on parse_elf()
> to succeed first. So, move the suffix ".o" check before checking
> parse_elf() result to prevent resource leak when the modname didn't have
> suffix ".o" and return early.
>
> [...]

Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>

--
Cheers,
Nathan