diff options
Diffstat (limited to 'arch/powerpc/lib/code-patching.c')
| -rw-r--r-- | arch/powerpc/lib/code-patching.c | 23 | 
1 files changed, 13 insertions, 10 deletions
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index 6ae2777c220d..89502cbccb1b 100644 --- a/arch/powerpc/lib/code-patching.c +++ b/arch/powerpc/lib/code-patching.c @@ -28,12 +28,6 @@ static int __patch_instruction(unsigned int *exec_addr, unsigned int instr,  {  	int err; -	/* Make sure we aren't patching a freed init section */ -	if (init_mem_is_free && init_section_contains(exec_addr, 4)) { -		pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr); -		return 0; -	} -  	__put_user_size(instr, patch_addr, 4, err);  	if (err)  		return err; @@ -104,8 +98,7 @@ static int map_patch_area(void *addr, unsigned long text_poke_addr)  	else  		pfn = __pa_symbol(addr) >> PAGE_SHIFT; -	err = map_kernel_page(text_poke_addr, (pfn << PAGE_SHIFT), -				pgprot_val(PAGE_KERNEL)); +	err = map_kernel_page(text_poke_addr, (pfn << PAGE_SHIFT), PAGE_KERNEL);  	pr_devel("Mapped addr %lx with pfn %lx:%d\n", text_poke_addr, pfn, err);  	if (err) @@ -148,7 +141,7 @@ static inline int unmap_patch_area(unsigned long addr)  	return 0;  } -int patch_instruction(unsigned int *addr, unsigned int instr) +static int do_patch_instruction(unsigned int *addr, unsigned int instr)  {  	int err;  	unsigned int *patch_addr = NULL; @@ -188,12 +181,22 @@ out:  }  #else /* !CONFIG_STRICT_KERNEL_RWX */ -int patch_instruction(unsigned int *addr, unsigned int instr) +static int do_patch_instruction(unsigned int *addr, unsigned int instr)  {  	return raw_patch_instruction(addr, instr);  }  #endif /* CONFIG_STRICT_KERNEL_RWX */ + +int patch_instruction(unsigned int *addr, unsigned int instr) +{ +	/* Make sure we aren't patching a freed init section */ +	if (init_mem_is_free && init_section_contains(addr, 4)) { +		pr_debug("Skipping init section patching addr: 0x%px\n", addr); +		return 0; +	} +	return do_patch_instruction(addr, instr); +}  NOKPROBE_SYMBOL(patch_instruction);  int patch_branch(unsigned int *addr, unsigned long target, int flags)  | 
