Skip to content

Commit 2f73c62

Browse files
covanampalmer-dabbelt
authored andcommitted
Revert "riscv: misaligned: fix sleeping function called during misaligned access handling"
This reverts commit 61a74ad ("riscv: misaligned: fix sleeping function called during misaligned access handling"). The commit addresses a sleeping in atomic context problem, but it is not the correct fix as explained by Clément: "Using nofault would lead to failure to read from user memory that is paged out for instance. This is not really acceptable, we should handle user misaligned access even at an address that would generate a page fault." This bug has been properly fixed by commit 453805f ("riscv: misaligned: enable IRQs while handling misaligned accesses"). Revert this improper fix. Link: https://lore.kernel.org/linux-riscv/[email protected]/ Signed-off-by: Nam Cao <[email protected]> Cc: [email protected] Reviewed-by: Clément Léger <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Fixes: 61a74ad ("riscv: misaligned: fix sleeping function called during misaligned access handling") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 850f0e2 commit 2f73c62

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/riscv/kernel/traps_misaligned.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static int handle_scalar_misaligned_load(struct pt_regs *regs)
454454

455455
val.data_u64 = 0;
456456
if (user_mode(regs)) {
457-
if (copy_from_user_nofault(&val, (u8 __user *)addr, len))
457+
if (copy_from_user(&val, (u8 __user *)addr, len))
458458
return -1;
459459
} else {
460460
memcpy(&val, (u8 *)addr, len);
@@ -555,7 +555,7 @@ static int handle_scalar_misaligned_store(struct pt_regs *regs)
555555
return -EOPNOTSUPP;
556556

557557
if (user_mode(regs)) {
558-
if (copy_to_user_nofault((u8 __user *)addr, &val, len))
558+
if (copy_to_user((u8 __user *)addr, &val, len))
559559
return -1;
560560
} else {
561561
memcpy((u8 *)addr, &val, len);

0 commit comments

Comments
 (0)