diff options
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 6298f75d5e93..98beda47bc99 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1268,18 +1268,11 @@ skip_hashing: | |||
1268 | 1268 | ||
1269 | void rt_bind_peer(struct rtable *rt, int create) | 1269 | void rt_bind_peer(struct rtable *rt, int create) |
1270 | { | 1270 | { |
1271 | static DEFINE_SPINLOCK(rt_peer_lock); | ||
1272 | struct inet_peer *peer; | 1271 | struct inet_peer *peer; |
1273 | 1272 | ||
1274 | peer = inet_getpeer(rt->rt_dst, create); | 1273 | peer = inet_getpeer(rt->rt_dst, create); |
1275 | 1274 | ||
1276 | spin_lock_bh(&rt_peer_lock); | 1275 | if (peer && cmpxchg(&rt->peer, NULL, peer) != NULL) |
1277 | if (rt->peer == NULL) { | ||
1278 | rt->peer = peer; | ||
1279 | peer = NULL; | ||
1280 | } | ||
1281 | spin_unlock_bh(&rt_peer_lock); | ||
1282 | if (peer) | ||
1283 | inet_putpeer(peer); | 1276 | inet_putpeer(peer); |
1284 | } | 1277 | } |
1285 | 1278 | ||
@@ -2586,7 +2579,7 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, | |||
2586 | goto out; | 2579 | goto out; |
2587 | 2580 | ||
2588 | /* RACE: Check return value of inet_select_addr instead. */ | 2581 | /* RACE: Check return value of inet_select_addr instead. */ |
2589 | if (__in_dev_get_rtnl(dev_out) == NULL) { | 2582 | if (rcu_dereference_raw(dev_out->ip_ptr) == NULL) { |
2590 | dev_put(dev_out); | 2583 | dev_put(dev_out); |
2591 | goto out; /* Wrong error code */ | 2584 | goto out; /* Wrong error code */ |
2592 | } | 2585 | } |
@@ -2798,7 +2791,7 @@ static int ipv4_dst_blackhole(struct net *net, struct rtable **rp, struct flowi | |||
2798 | 2791 | ||
2799 | dst_release(&(*rp)->dst); | 2792 | dst_release(&(*rp)->dst); |
2800 | *rp = rt; | 2793 | *rp = rt; |
2801 | return (rt ? 0 : -ENOMEM); | 2794 | return rt ? 0 : -ENOMEM; |
2802 | } | 2795 | } |
2803 | 2796 | ||
2804 | int ip_route_output_flow(struct net *net, struct rtable **rp, struct flowi *flp, | 2797 | int ip_route_output_flow(struct net *net, struct rtable **rp, struct flowi *flp, |