Skip to content
/ linux Public

Commit 8dd23bb

Browse files
seehearfeelgregkh
authored andcommitted
LoongArch: No need to flush icache if text copy failed
commit d3b8491 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 250aae6 commit 8dd23bb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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)