Patchwork [3/3] netfilter: ip6_route_output() never returns NULL.

login
register
mail settings
Submitter roy.qing.li@gmail.com
Date Feb. 22, 2012, 8:10 a.m.
Message ID <1329898251-5357-3-git-send-email-roy.qing.li@gmail.com>
Download mbox | patch
Permalink /patch/142415/
State Accepted
Delegated to: David Miller
Headers show

Comments

roy.qing.li@gmail.com - Feb. 22, 2012, 8:10 a.m.
From: RongQing.Li <roy.qing.li@gmail.com>

ip6_route_output() never returns NULL, so it is wrong to
check if the return value is NULL.

Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
---
 net/netfilter/xt_TEE.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
David Miller - Feb. 22, 2012, 7:50 p.m.
From: roy.qing.li@gmail.com
Date: Wed, 22 Feb 2012 16:10:51 +0800

> From: RongQing.Li <roy.qing.li@gmail.com>
> 
> ip6_route_output() never returns NULL, so it is wrong to
> check if the return value is NULL.
> 
> Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 3aae66f..4d50579 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -152,9 +152,10 @@  tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info)
 	fl6.flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) |
 			   (iph->flow_lbl[1] << 8) | iph->flow_lbl[2];
 	dst = ip6_route_output(net, NULL, &fl6);
-	if (dst == NULL)
+	if (dst->error) {
+		dst_release(dst);
 		return false;
-
+	}
 	skb_dst_drop(skb);
 	skb_dst_set(skb, dst);
 	skb->dev      = dst->dev;