Re: [PATCH v2] livepatch: Fix NULL pointer dereference in klp_find_func()

Petr Mladek <[email protected]> Tue, 7 Jul 2026 14:10:13 +0200
Newsgroups org.kernel.vger.live-patching
Message-ID <[email protected]>
On Sun 2026-06-28 19:46:35, Yafang Shao wrote:
> A NULL old_name in a newly loaded livepatch's function entry causes a
> NULL pointer dereference in strcmp():
> 
>   klp_init_patch()
>     klp_add_nops()
>       klp_find_func()
>         strcmp(old_func->old_name, func->old_name)
> 
> Add klp_check_patch() at the beginning of klp_enable_patch() to reject
> patches with NULL old_name before they reach this code path.
> 
> Reported-by: sashiko-bot <[email protected]>
> Closes: https://lore.kernel.org/live-patching/[email protected]/
> Suggested-by: Petr Mladek <[email protected]>
> Suggested-by: Miroslav Benes <[email protected]>
> Signed-off-by: Yafang Shao <[email protected]>
> Acked-by: Miroslav Benes <[email protected]>

JFYI, the patch has been committed into livepatching.git,
branch for-7.3/trivial.

Best Regards,
Petr