mirror of https://github.com/torvalds/linux.git
futex: Use user_write_access_begin/_end() in futex_put_value()
Commitcec199c5e3("futex: Implement FUTEX2_NUMA") introduced the futex_put_value() helper to write a value to the given user address. However, it uses user_read_access_begin() before the write. For architectures that differentiate between read and write accesses, like PowerPC, futex_put_value() fails with -EFAULT. Fix that by using the user_write_access_begin/user_write_access_end() pair instead. Fixes:cec199c5e3("futex: Implement FUTEX2_NUMA") Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20250811141147.322261-1-longman@redhat.com
This commit is contained in:
parent
e703b7e247
commit
dfb36e4a8d
|
|
@ -319,13 +319,13 @@ static __always_inline int futex_put_value(u32 val, u32 __user *to)
|
|||
{
|
||||
if (can_do_masked_user_access())
|
||||
to = masked_user_access_begin(to);
|
||||
else if (!user_read_access_begin(to, sizeof(*to)))
|
||||
else if (!user_write_access_begin(to, sizeof(*to)))
|
||||
return -EFAULT;
|
||||
unsafe_put_user(val, to, Efault);
|
||||
user_read_access_end();
|
||||
user_write_access_end();
|
||||
return 0;
|
||||
Efault:
|
||||
user_read_access_end();
|
||||
user_write_access_end();
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue