Skip to content

Commit d3b8491

Browse files
seehearfeelchenhuacai
authored andcommitted
LoongArch: No need to flush icache if text copy failed
If copy_to_kernel_nofault() failed, no need to flush icache and just return immediately. Cc: stable@vger.kernel.org Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 431ce83 commit d3b8491

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

arch/loongarch/kernel/inst.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,15 @@ static int text_copy_cb(void *data)
246246

247247
if (smp_processor_id() == copy->cpu) {
248248
ret = copy_to_kernel_nofault(copy->dst, copy->src, copy->len);
249-
if (ret)
249+
if (ret) {
250250
pr_err("%s: operation failed\n", __func__);
251+
return ret;
252+
}
251253
}
252254

253255
flush_icache_range((unsigned long)copy->dst, (unsigned long)copy->dst + copy->len);
254256

255-
return ret;
257+
return 0;
256258
}
257259

258260
int larch_insn_text_copy(void *dst, void *src, size_t len)

0 commit comments

Comments
 (0)