diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 11 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_hashlimit.c | 9 |
2 files changed, 11 insertions, 9 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 | ||
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index dc1521c5aa81..ba5e23505e88 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | /* FIXME: this is just for IP_NF_ASSERRT */ | 41 | /* FIXME: this is just for IP_NF_ASSERRT */ |
42 | #include <linux/netfilter_ipv4/ip_conntrack.h> | 42 | #include <linux/netfilter_ipv4/ip_conntrack.h> |
43 | #include <linux/mutex.h> | ||
43 | 44 | ||
44 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
45 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | 46 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); |
@@ -92,7 +93,7 @@ struct ipt_hashlimit_htable { | |||
92 | }; | 93 | }; |
93 | 94 | ||
94 | static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */ | 95 | static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */ |
95 | static DECLARE_MUTEX(hlimit_mutex); /* additional checkentry protection */ | 96 | static DEFINE_MUTEX(hlimit_mutex); /* additional checkentry protection */ |
96 | static HLIST_HEAD(hashlimit_htables); | 97 | static HLIST_HEAD(hashlimit_htables); |
97 | static kmem_cache_t *hashlimit_cachep __read_mostly; | 98 | static kmem_cache_t *hashlimit_cachep __read_mostly; |
98 | 99 | ||
@@ -542,13 +543,13 @@ hashlimit_checkentry(const char *tablename, | |||
542 | * call vmalloc, and that can sleep. And we cannot just re-search | 543 | * call vmalloc, and that can sleep. And we cannot just re-search |
543 | * the list of htable's in htable_create(), since then we would | 544 | * the list of htable's in htable_create(), since then we would |
544 | * create duplicate proc files. -HW */ | 545 | * create duplicate proc files. -HW */ |
545 | down(&hlimit_mutex); | 546 | mutex_lock(&hlimit_mutex); |
546 | r->hinfo = htable_find_get(r->name); | 547 | r->hinfo = htable_find_get(r->name); |
547 | if (!r->hinfo && (htable_create(r) != 0)) { | 548 | if (!r->hinfo && (htable_create(r) != 0)) { |
548 | up(&hlimit_mutex); | 549 | mutex_unlock(&hlimit_mutex); |
549 | return 0; | 550 | return 0; |
550 | } | 551 | } |
551 | up(&hlimit_mutex); | 552 | mutex_unlock(&hlimit_mutex); |
552 | 553 | ||
553 | /* Ugly hack: For SMP, we only want to use one set */ | 554 | /* Ugly hack: For SMP, we only want to use one set */ |
554 | r->u.master = r; | 555 | r->u.master = r; |