aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/udp.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2011-10-09 10:56:44 +0800
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-16 14:14:54 -0700
commita1b7ab0836a56fa4c9578f88ba1042398d7d9316 (patch)
tree5b5435397e994519b529c143c6960a35eb015308 /net/ipv6/udp.c
parent00b8e8ceece20db990b1fbb11f1d6051a276436b (diff)
downloadkernel_samsung_smdk4412-a1b7ab0836a56fa4c9578f88ba1042398d7d9316.zip
kernel_samsung_smdk4412-a1b7ab0836a56fa4c9578f88ba1042398d7d9316.tar.gz
kernel_samsung_smdk4412-a1b7ab0836a56fa4c9578f88ba1042398d7d9316.tar.bz2
ipv6: fix NULL dereference in udp6_ufo_fragment()
This patch fixes the issue caused by ef81bb40bf15f350fe865f31fa42f1082772a576 which is a backport of upstream 87c48fa3b4630905f98268dde838ee43626a060c. The problem does not exist in upstream. We do not check whether route is attached before trying to assign ip identification through route dest which lead NULL pointer dereference. This happens when host bridge transmit a packet from guest. This patch changes ipv6_select_ident() to accept in6_addr as its paramter and fix the issue by using the destination address in ipv6 header when no route is attached. Signed-off-by: Jason Wang <jasowang@redhat.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r--net/ipv6/udp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 29213b5..0d920c5 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1309,6 +1309,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features)
u8 frag_hdr_sz = sizeof(struct frag_hdr);
int offset;
__wsum csum;
+ struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
mss = skb_shinfo(skb)->gso_size;
if (unlikely(skb->len <= mss))
@@ -1359,7 +1360,8 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features)
fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);
fptr->nexthdr = nexthdr;
fptr->reserved = 0;
- ipv6_select_ident(fptr, (struct rt6_info *)skb_dst(skb));
+ ipv6_select_ident(fptr,
+ rt ? &rt->rt6i_dst.addr : &ipv6_hdr(skb)->daddr);
/* Fragment the skb. ipv6 header and the remaining fields of the
* fragment header are updated in ipv6_gso_segment()