[IPV6] ROUTE: Make sure we do not exceed args in fib6_lookup_1().
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>
This commit is contained in:
committed by
David S. Miller
parent
3fc5e0440b
commit
825e288ef4
@@ -829,6 +829,9 @@ static struct fib6_node * fib6_lookup_1(struct fib6_node *root,
|
|||||||
struct fib6_node *fn;
|
struct fib6_node *fn;
|
||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
|
if (unlikely(args->offset == 0))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Descend on a tree
|
* Descend on a tree
|
||||||
*/
|
*/
|
||||||
@@ -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 fib6_node * fib6_lookup(struct fib6_node *root, struct in6_addr *daddr,
|
||||||
struct in6_addr *saddr)
|
struct in6_addr *saddr)
|
||||||
{
|
{
|
||||||
struct lookup_args args[2];
|
|
||||||
struct fib6_node *fn;
|
struct fib6_node *fn;
|
||||||
|
struct lookup_args args[] = {
|
||||||
args[0].offset = offsetof(struct rt6_info, rt6i_dst);
|
{
|
||||||
args[0].addr = daddr;
|
.offset = offsetof(struct rt6_info, rt6i_dst),
|
||||||
|
.addr = daddr,
|
||||||
|
},
|
||||||
#ifdef CONFIG_IPV6_SUBTREES
|
#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
|
#endif
|
||||||
|
{
|
||||||
|
.offset = 0, /* sentinel */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
fn = fib6_lookup_1(root, args);
|
fn = fib6_lookup_1(root, args);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user