[Devel] [PATCH RHEL7 COMMIT] vznetstat: Add protection to venet_acct_set_classes()
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Dec 20 12:47:14 MSK 2017
The commit is pushed to "branch-rh7-3.10.0-693.11.1.vz7.39.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.11.1.vz7.39.8
------>
commit 68c9f986a45fa08c2f2d3fdb57f23239581c7213
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Wed Dec 20 12:47:14 2017 +0300
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>
---
kernel/ve/vznetstat/vznetstat.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
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