diff options
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 9bdc79564cc6..088888db8b3d 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1182,17 +1182,13 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | |||
1182 | int s_ip_idx, s_idx = cb->args[0]; | 1182 | int s_ip_idx, s_idx = cb->args[0]; |
1183 | 1183 | ||
1184 | s_ip_idx = ip_idx = cb->args[1]; | 1184 | s_ip_idx = ip_idx = cb->args[1]; |
1185 | read_lock(&dev_base_lock); | ||
1186 | for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) { | 1185 | for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) { |
1187 | if (idx < s_idx) | 1186 | if (idx < s_idx) |
1188 | continue; | 1187 | continue; |
1189 | if (idx > s_idx) | 1188 | if (idx > s_idx) |
1190 | s_ip_idx = 0; | 1189 | s_ip_idx = 0; |
1191 | rcu_read_lock(); | 1190 | if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) |
1192 | if ((in_dev = __in_dev_get_rcu(dev)) == NULL) { | ||
1193 | rcu_read_unlock(); | ||
1194 | continue; | 1191 | continue; |
1195 | } | ||
1196 | 1192 | ||
1197 | for (ifa = in_dev->ifa_list, ip_idx = 0; ifa; | 1193 | for (ifa = in_dev->ifa_list, ip_idx = 0; ifa; |
1198 | ifa = ifa->ifa_next, ip_idx++) { | 1194 | ifa = ifa->ifa_next, ip_idx++) { |
@@ -1200,16 +1196,12 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | |||
1200 | continue; | 1196 | continue; |
1201 | if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid, | 1197 | if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid, |
1202 | cb->nlh->nlmsg_seq, | 1198 | cb->nlh->nlmsg_seq, |
1203 | RTM_NEWADDR, NLM_F_MULTI) <= 0) { | 1199 | RTM_NEWADDR, NLM_F_MULTI) <= 0) |
1204 | rcu_read_unlock(); | ||
1205 | goto done; | 1200 | goto done; |
1206 | } | ||
1207 | } | 1201 | } |
1208 | rcu_read_unlock(); | ||
1209 | } | 1202 | } |
1210 | 1203 | ||
1211 | done: | 1204 | done: |
1212 | read_unlock(&dev_base_lock); | ||
1213 | cb->args[0] = idx; | 1205 | cb->args[0] = idx; |
1214 | cb->args[1] = ip_idx; | 1206 | cb->args[1] = ip_idx; |
1215 | 1207 | ||