diff options
author | Brian Haley <brian.haley@hp.com> | 2008-08-13 04:58:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-13 04:58:57 -0400 |
commit | 5e0115e500fe9dd2ca11e6f92db9123204f1327a (patch) | |
tree | 951ad51ba761be1bf8e79b54d9a7ff160a4720be /net/ipv6/route.c | |
parent | 987c402ac31988f7ecdb38b657bcfeea5831d479 (diff) |
ipv6: Fix OOPS, ip -f inet6 route get fec0::1, linux-2.6.26, ip6_route_output, rt6_fill_node+0x175
Alexey Dobriyan wrote:
> On Thu, Aug 07, 2008 at 07:00:56PM +0200, John Gumb wrote:
>> Scenario: no ipv6 default route set.
>
>> # ip -f inet6 route get fec0::1
>>
>> BUG: unable to handle kernel NULL pointer dereference at 00000000
>> IP: [<c0369b85>] rt6_fill_node+0x175/0x3b0
>> EIP is at rt6_fill_node+0x175/0x3b0
>
> 0xffffffff80424dd3 is in rt6_fill_node (net/ipv6/route.c:2191).
> 2186 } else
> 2187 #endif
> 2188 NLA_PUT_U32(skb, RTA_IIF, iif);
> 2189 } else if (dst) {
> 2190 struct in6_addr saddr_buf;
> 2191 ====> if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev,
> ^^^^^^^^^^^^^^^^^^^^^^^^
> NULL
>
> 2192 dst, 0, &saddr_buf) == 0)
> 2193 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
> 2194 }
The commit that changed this can't be reverted easily, but the patch
below works for me.
Fix NULL de-reference in rt6_fill_node() when there's no IPv6 input
device present in the dst entry.
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 5a3e87e4b18f..41b165ffb369 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2187,8 +2187,9 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, | |||
2187 | #endif | 2187 | #endif |
2188 | NLA_PUT_U32(skb, RTA_IIF, iif); | 2188 | NLA_PUT_U32(skb, RTA_IIF, iif); |
2189 | } else if (dst) { | 2189 | } else if (dst) { |
2190 | struct inet6_dev *idev = ip6_dst_idev(&rt->u.dst); | ||
2190 | struct in6_addr saddr_buf; | 2191 | struct in6_addr saddr_buf; |
2191 | if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev, | 2192 | if (ipv6_dev_get_saddr(idev ? idev->dev : NULL, |
2192 | dst, 0, &saddr_buf) == 0) | 2193 | dst, 0, &saddr_buf) == 0) |
2193 | NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf); | 2194 | NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf); |
2194 | } | 2195 | } |