[Devel] [PATCH 1/2] vznetstat: Add protection to venet_acct_set_classes()
Andrey Ryabinin
aryabinin at virtuozzo.com
Wed Dec 20 12:47:07 MSK 2017
On 12/20/2017 12:30 PM, Kirill Tkhai wrote:
>> How you about this?
>>
> vznetstat: Add protection to venet_acct_set_classes()
>
> It seems there was no synchronization since the time
> when ioctls in kernel were serialized via single mutex.
>
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
Acked-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
> diff --git a/kernel/ve/vznetstat/vznetstat.c b/kernel/ve/vznetstat/vznetstat.c
> index 3a53ce27bde2..92541dbc2a3f 100644
> --- a/kernel/ve/vznetstat/vznetstat.c
> +++ b/kernel/ve/vznetstat/vznetstat.c
> @@ -88,15 +88,11 @@ static int venet_acct_set_classes(const void __user *user_info, int length, int
> goto out_free;
> }
>
> - rcu_read_lock();
> - if (v6) {
> - old = rcu_dereference(info_v6);
> - rcu_assign_pointer(info_v6, info);
> - } else {
> - old = rcu_dereference(info_v4);
> - rcu_assign_pointer(info_v4, info);
> - }
> - rcu_read_unlock();
> + if (v6)
> + old = xchg(&info_v6, info);
> + else
> + old = xchg(&info_v4, info);
> + /* xchg() implies rcu_assign_pointer() barriers */
>
> synchronize_net();
> /* IMPORTANT. I think reset of statistics collected should not be
>
More information about the Devel
mailing list