diff options
Diffstat (limited to 'net/ipv4/ipvs/ip_vs_ctl.c')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 7f0288b25fa1..f28ec6882162 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include <linux/netfilter.h> | 35 | #include <linux/netfilter.h> |
36 | #include <linux/netfilter_ipv4.h> | 36 | #include <linux/netfilter_ipv4.h> |
37 | #include <linux/mutex.h> | ||
37 | 38 | ||
38 | #include <net/ip.h> | 39 | #include <net/ip.h> |
39 | #include <net/route.h> | 40 | #include <net/route.h> |
@@ -44,7 +45,7 @@ | |||
44 | #include <net/ip_vs.h> | 45 | #include <net/ip_vs.h> |
45 | 46 | ||
46 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ | 47 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ |
47 | static DECLARE_MUTEX(__ip_vs_mutex); | 48 | static DEFINE_MUTEX(__ip_vs_mutex); |
48 | 49 | ||
49 | /* lock for service table */ | 50 | /* lock for service table */ |
50 | static DEFINE_RWLOCK(__ip_vs_svc_lock); | 51 | static DEFINE_RWLOCK(__ip_vs_svc_lock); |
@@ -1950,7 +1951,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
1950 | /* increase the module use count */ | 1951 | /* increase the module use count */ |
1951 | ip_vs_use_count_inc(); | 1952 | ip_vs_use_count_inc(); |
1952 | 1953 | ||
1953 | if (down_interruptible(&__ip_vs_mutex)) { | 1954 | if (mutex_lock_interruptible(&__ip_vs_mutex)) { |
1954 | ret = -ERESTARTSYS; | 1955 | ret = -ERESTARTSYS; |
1955 | goto out_dec; | 1956 | goto out_dec; |
1956 | } | 1957 | } |
@@ -2041,7 +2042,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
2041 | ip_vs_service_put(svc); | 2042 | ip_vs_service_put(svc); |
2042 | 2043 | ||
2043 | out_unlock: | 2044 | out_unlock: |
2044 | up(&__ip_vs_mutex); | 2045 | mutex_unlock(&__ip_vs_mutex); |
2045 | out_dec: | 2046 | out_dec: |
2046 | /* decrease the module use count */ | 2047 | /* decrease the module use count */ |
2047 | ip_vs_use_count_dec(); | 2048 | ip_vs_use_count_dec(); |
@@ -2211,7 +2212,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2211 | if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) | 2212 | if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) |
2212 | return -EFAULT; | 2213 | return -EFAULT; |
2213 | 2214 | ||
2214 | if (down_interruptible(&__ip_vs_mutex)) | 2215 | if (mutex_lock_interruptible(&__ip_vs_mutex)) |
2215 | return -ERESTARTSYS; | 2216 | return -ERESTARTSYS; |
2216 | 2217 | ||
2217 | switch (cmd) { | 2218 | switch (cmd) { |
@@ -2330,7 +2331,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2330 | } | 2331 | } |
2331 | 2332 | ||
2332 | out: | 2333 | out: |
2333 | up(&__ip_vs_mutex); | 2334 | mutex_unlock(&__ip_vs_mutex); |
2334 | return ret; | 2335 | return ret; |
2335 | } | 2336 | } |
2336 | 2337 | ||