lkml.org 
[lkml]   [2014]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 21/29] nios2: Futex operations
From
On Tue, Jul 15, 2014 at 6:03 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Tue, 15 Jul 2014, Ley Foon Tan wrote:
> +static inline int atomic_futex_op_xchg_set(int oparg, u32 __user *uaddr,
>> + int *oldval)
>> +{
>> + unsigned long flags;
>> + int ret;
>> +
>> + local_irq_save(flags);
>> +
>> + ret = get_user(*oldval, uaddr);
>> + if (!ret)
>> + ret = put_user(oparg, uaddr);
>
> This is wrong as it gets. get_user() might fault and sleep.
>
> You need a proper implementation, which handles fault exceptions.
I have checked that we use nios2 specific get_user() in [1]. This
function will not sleep and it handles fault exception.
I think this should be fine.

[1] http://rocketboards.org/gitweb/?p=linux-socfpga-next.git;a=blob;f=arch/nios2/include/asm/uaccess.h;h=3e36f536afaba24c308a8416a66b8a2573e042a5;hb=refs/heads/nios2-upstream

Regards
Ley Foon


\
 
 \ /
  Last update: 2014-07-18 17:21    [W:2.563 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site