Skip to content

Commit

Permalink
[IPV6] ROUTE: Make sure we do not exceed args in fib6_lookup_1().
Browse files Browse the repository at this point in the history
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: Ville Nuorvala <vnuorval@tcs.hut.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YOSHIFUJI Hideaki authored and David S. Miller committed Sep 22, 2006
1 parent 3fc5e04 commit 825e288
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions net/ipv6/ip6_fib.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,9 @@ static struct fib6_node * fib6_lookup_1(struct fib6_node *root,
struct fib6_node *fn;
int dir;

if (unlikely(args->offset == 0))
return NULL;

/*
* Descend on a tree
*/
Expand Down Expand Up @@ -879,16 +882,22 @@ static struct fib6_node * fib6_lookup_1(struct fib6_node *root,
struct fib6_node * fib6_lookup(struct fib6_node *root, struct in6_addr *daddr,
struct in6_addr *saddr)
{
struct lookup_args args[2];
struct fib6_node *fn;

args[0].offset = offsetof(struct rt6_info, rt6i_dst);
args[0].addr = daddr;

struct lookup_args args[] = {
{
.offset = offsetof(struct rt6_info, rt6i_dst),
.addr = daddr,
},
#ifdef CONFIG_IPV6_SUBTREES
args[1].offset = offsetof(struct rt6_info, rt6i_src);
args[1].addr = saddr;
{
.offset = offsetof(struct rt6_info, rt6i_src),
.addr = saddr,
},
#endif
{
.offset = 0, /* sentinel */
}
};

fn = fib6_lookup_1(root, args);

Expand Down

0 comments on commit 825e288

Please sign in to comment.