diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-09 22:12:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-09 22:12:36 -0400 |
commit | c0efc887dcadbdbfe171f028acfab9c7c00e9dde (patch) | |
tree | d2f628d6c222c6328a6f310378d7227c32ebf183 /net/ipv4/inetpeer.c | |
parent | 8b51b064a6da90c68af5385a874968829a2a0ed7 (diff) |
inet: Pass inetpeer root into inet_getpeer*() interfaces.
Otherwise we reference potentially non-existing members when
ipv6 is disabled.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inetpeer.c')
-rw-r--r-- | net/ipv4/inetpeer.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index 9d89a381f0e1..e4cba56a5349 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -391,12 +391,6 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base, | |||
391 | call_rcu(&p->rcu, inetpeer_free_rcu); | 391 | call_rcu(&p->rcu, inetpeer_free_rcu); |
392 | } | 392 | } |
393 | 393 | ||
394 | static struct inet_peer_base *family_to_base(struct net *net, | ||
395 | int family) | ||
396 | { | ||
397 | return family == AF_INET ? net->ipv4.peers : net->ipv6.peers; | ||
398 | } | ||
399 | |||
400 | /* perform garbage collect on all items stacked during a lookup */ | 394 | /* perform garbage collect on all items stacked during a lookup */ |
401 | static int inet_peer_gc(struct inet_peer_base *base, | 395 | static int inet_peer_gc(struct inet_peer_base *base, |
402 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], | 396 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], |
@@ -434,12 +428,11 @@ static int inet_peer_gc(struct inet_peer_base *base, | |||
434 | return cnt; | 428 | return cnt; |
435 | } | 429 | } |
436 | 430 | ||
437 | struct inet_peer *inet_getpeer(struct net *net, | 431 | struct inet_peer *inet_getpeer(struct inet_peer_base *base, |
438 | const struct inetpeer_addr *daddr, | 432 | const struct inetpeer_addr *daddr, |
439 | int create) | 433 | int create) |
440 | { | 434 | { |
441 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr; | 435 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr; |
442 | struct inet_peer_base *base = family_to_base(net, daddr->family); | ||
443 | struct inet_peer *p; | 436 | struct inet_peer *p; |
444 | unsigned int sequence; | 437 | unsigned int sequence; |
445 | int invalidated, gccnt = 0; | 438 | int invalidated, gccnt = 0; |