mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
powerpc/kprobes: Handle error returned by set_memory_rox()
set_memory_rox() can fail. In case it fails, free allocated memory and return NULL. Link: https://github.com/KSPP/linux/issues/7 Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/b4907cf4339bd086abc40430d91311436cb0c18e.1708078401.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
09ca1b1171
commit
f7f18e30b4
1 changed files with 8 additions and 2 deletions
|
@ -134,10 +134,16 @@ void *alloc_insn_page(void)
|
||||||
if (!page)
|
if (!page)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (strict_module_rwx_enabled())
|
if (strict_module_rwx_enabled()) {
|
||||||
set_memory_rox((unsigned long)page, 1);
|
int err = set_memory_rox((unsigned long)page, 1);
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
return page;
|
return page;
|
||||||
|
error:
|
||||||
|
module_memfree(page);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int arch_prepare_kprobe(struct kprobe *p)
|
int arch_prepare_kprobe(struct kprobe *p)
|
||||||
|
|
Loading…
Add table
Reference in a new issue