diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2016-10-20 17:19:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-22 16:23:12 -0400 |
commit | 396a30cce15d084b2b1a395aa6d515c3d559c674 (patch) | |
tree | e9421ffe250b8f5c509142bd79d313de39976457 | |
parent | 860e0217fcc9c52013d2dde0b5953fdc95276fc1 (diff) |
ipv4: use the right lock for ping_group_range
This reverts commit a681574c99be23e4d20b769bf0e543239c364af5
("ipv4: disable BH in set_ping_group_range()") because we never
read ping_group_range in BH context (unlike local_port_range).
Then, since we already have a lock for ping_group_range, those
using ip_local_ports.lock for ping_group_range are clearly typos.
We might consider to share a same lock for both ping_group_range
and local_port_range w.r.t. space saving, but that should be for
net-next.
Fixes: a681574c99be ("ipv4: disable BH in set_ping_group_range()")
Fixes: ba6b918ab234 ("ping: move ping_group_range out of CONFIG_SYSCTL")
Cc: Eric Dumazet <edumazet@google.com>
Cc: Eric Salo <salo@google.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/sysctl_net_ipv4.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 500ae4010bed..80bc36b25de2 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -96,11 +96,11 @@ static void inet_get_ping_group_range_table(struct ctl_table *table, kgid_t *low | |||
96 | container_of(table->data, struct net, ipv4.ping_group_range.range); | 96 | container_of(table->data, struct net, ipv4.ping_group_range.range); |
97 | unsigned int seq; | 97 | unsigned int seq; |
98 | do { | 98 | do { |
99 | seq = read_seqbegin(&net->ipv4.ip_local_ports.lock); | 99 | seq = read_seqbegin(&net->ipv4.ping_group_range.lock); |
100 | 100 | ||
101 | *low = data[0]; | 101 | *low = data[0]; |
102 | *high = data[1]; | 102 | *high = data[1]; |
103 | } while (read_seqretry(&net->ipv4.ip_local_ports.lock, seq)); | 103 | } while (read_seqretry(&net->ipv4.ping_group_range.lock, seq)); |
104 | } | 104 | } |
105 | 105 | ||
106 | /* Update system visible IP port range */ | 106 | /* Update system visible IP port range */ |
@@ -109,10 +109,10 @@ static void set_ping_group_range(struct ctl_table *table, kgid_t low, kgid_t hig | |||
109 | kgid_t *data = table->data; | 109 | kgid_t *data = table->data; |
110 | struct net *net = | 110 | struct net *net = |
111 | container_of(table->data, struct net, ipv4.ping_group_range.range); | 111 | container_of(table->data, struct net, ipv4.ping_group_range.range); |
112 | write_seqlock_bh(&net->ipv4.ip_local_ports.lock); | 112 | write_seqlock(&net->ipv4.ping_group_range.lock); |
113 | data[0] = low; | 113 | data[0] = low; |
114 | data[1] = high; | 114 | data[1] = high; |
115 | write_sequnlock_bh(&net->ipv4.ip_local_ports.lock); | 115 | write_sequnlock(&net->ipv4.ping_group_range.lock); |
116 | } | 116 | } |
117 | 117 | ||
118 | /* Validate changes from /proc interface. */ | 118 | /* Validate changes from /proc interface. */ |