]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
0be8343214617b2c56584c9015fe2f743fd3c8b2
[thirdparty/kernel/stable-queue.git] /
1 From 2f73c62d4e13df67380ff6faca39eec2bf08dd93 Mon Sep 17 00:00:00 2001
2 From: Nam Cao <namcao@linutronix.de>
3 Date: Fri, 20 Jun 2025 13:09:39 +0200
4 Subject: Revert "riscv: misaligned: fix sleeping function called during misaligned access handling"
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Nam Cao <namcao@linutronix.de>
10
11 commit 2f73c62d4e13df67380ff6faca39eec2bf08dd93 upstream.
12
13 This reverts commit 61a74ad25462 ("riscv: misaligned: fix sleeping function
14 called during misaligned access handling"). The commit addresses a sleeping
15 in atomic context problem, but it is not the correct fix as explained by
16 Clément:
17
18 "Using nofault would lead to failure to read from user memory that is paged
19 out for instance. This is not really acceptable, we should handle user
20 misaligned access even at an address that would generate a page fault."
21
22 This bug has been properly fixed by commit 453805f0a28f ("riscv:
23 misaligned: enable IRQs while handling misaligned accesses").
24
25 Revert this improper fix.
26
27 Link: https://lore.kernel.org/linux-riscv/b779beed-e44e-4a5e-9551-4647682b0d21@rivosinc.com/
28 Signed-off-by: Nam Cao <namcao@linutronix.de>
29 Cc: stable@vger.kernel.org
30 Reviewed-by: Clément Léger <cleger@rivosinc.com>
31 Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
32 Fixes: 61a74ad25462 ("riscv: misaligned: fix sleeping function called during misaligned access handling")
33 Link: https://lore.kernel.org/r/20250620110939.1642735-1-namcao@linutronix.de
34 Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
35 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36 ---
37 arch/riscv/kernel/traps_misaligned.c | 4 ++--
38 1 file changed, 2 insertions(+), 2 deletions(-)
39
40 --- a/arch/riscv/kernel/traps_misaligned.c
41 +++ b/arch/riscv/kernel/traps_misaligned.c
42 @@ -453,7 +453,7 @@ static int handle_scalar_misaligned_load
43
44 val.data_u64 = 0;
45 if (user_mode(regs)) {
46 - if (copy_from_user_nofault(&val, (u8 __user *)addr, len))
47 + if (copy_from_user(&val, (u8 __user *)addr, len))
48 return -1;
49 } else {
50 memcpy(&val, (u8 *)addr, len);
51 @@ -554,7 +554,7 @@ static int handle_scalar_misaligned_stor
52 return -EOPNOTSUPP;
53
54 if (user_mode(regs)) {
55 - if (copy_to_user_nofault((u8 __user *)addr, &val, len))
56 + if (copy_to_user((u8 __user *)addr, &val, len))
57 return -1;
58 } else {
59 memcpy((u8 *)addr, &val, len);