netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ipv6: ip6_route_output() never returns NULL.
@ 2012-02-22  8:10 roy.qing.li
  2012-02-22  8:10 ` [PATCH 2/3] ethernet/broadcom: " roy.qing.li
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: roy.qing.li @ 2012-02-22  8:10 UTC (permalink / raw)
  To: netdev

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/ipv6/ip6mr.c |    4 +++-
 net/ipv6/ndisc.c |    5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index c7e95c8..5aa3981 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1926,8 +1926,10 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
 	};
 
 	dst = ip6_route_output(net, NULL, &fl6);
-	if (!dst)
+	if (dst->error) {
+		dst_release(dst);
 		goto out_free;
+	}
 
 	skb_dst_drop(skb);
 	skb_dst_set(skb, dst);
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 8d81701..3dcdb81 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1550,9 +1550,10 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 			 &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex);
 
 	dst = ip6_route_output(net, NULL, &fl6);
-	if (dst == NULL)
+	if (dst->error) {
+		dst_release(dst);
 		return;
-
+	}
 	dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
 	if (IS_ERR(dst))
 		return;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] ethernet/broadcom: ip6_route_output() never returns NULL.
  2012-02-22  8:10 [PATCH 1/3] ipv6: ip6_route_output() never returns NULL roy.qing.li
@ 2012-02-22  8:10 ` roy.qing.li
  2012-02-22 19:50   ` David Miller
  2012-02-22  8:10 ` [PATCH 3/3] netfilter: " roy.qing.li
  2012-02-22 19:50 ` [PATCH 1/3] ipv6: " David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: roy.qing.li @ 2012-02-22  8:10 UTC (permalink / raw)
  To: netdev

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>
---
 drivers/net/ethernet/broadcom/cnic.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index df42995..7b65716 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -3616,7 +3616,11 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
 		fl6.flowi6_oif = dst_addr->sin6_scope_id;
 
 	*dst = ip6_route_output(&init_net, NULL, &fl6);
-	if (*dst)
+	if ((*dst)->error) {
+		dst_release(*dst);
+		*dst = NULL;
+		return -ENETUNREACH;
+	} else
 		return 0;
 #endif
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] netfilter: ip6_route_output() never returns NULL.
  2012-02-22  8:10 [PATCH 1/3] ipv6: ip6_route_output() never returns NULL roy.qing.li
  2012-02-22  8:10 ` [PATCH 2/3] ethernet/broadcom: " roy.qing.li
@ 2012-02-22  8:10 ` roy.qing.li
  2012-02-22 19:50   ` David Miller
  2012-02-22 19:50 ` [PATCH 1/3] ipv6: " David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: roy.qing.li @ 2012-02-22  8:10 UTC (permalink / raw)
  To: netdev

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(-)

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;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] ipv6: ip6_route_output() never returns NULL.
  2012-02-22  8:10 [PATCH 1/3] ipv6: ip6_route_output() never returns NULL roy.qing.li
  2012-02-22  8:10 ` [PATCH 2/3] ethernet/broadcom: " roy.qing.li
  2012-02-22  8:10 ` [PATCH 3/3] netfilter: " roy.qing.li
@ 2012-02-22 19:50 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-02-22 19:50 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev

From: roy.qing.li@gmail.com
Date: Wed, 22 Feb 2012 16:10:49 +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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] ethernet/broadcom: ip6_route_output() never returns NULL.
  2012-02-22  8:10 ` [PATCH 2/3] ethernet/broadcom: " roy.qing.li
@ 2012-02-22 19:50   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-02-22 19:50 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev

From: roy.qing.li@gmail.com
Date: Wed, 22 Feb 2012 16:10:50 +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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] netfilter: ip6_route_output() never returns NULL.
  2012-02-22  8:10 ` [PATCH 3/3] netfilter: " roy.qing.li
@ 2012-02-22 19:50   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-02-22 19:50 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-22 19:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-22  8:10 [PATCH 1/3] ipv6: ip6_route_output() never returns NULL roy.qing.li
2012-02-22  8:10 ` [PATCH 2/3] ethernet/broadcom: " roy.qing.li
2012-02-22 19:50   ` David Miller
2012-02-22  8:10 ` [PATCH 3/3] netfilter: " roy.qing.li
2012-02-22 19:50   ` David Miller
2012-02-22 19:50 ` [PATCH 1/3] ipv6: " David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).