Patchwork [2/3] ethernet/broadcom: 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-2-git-send-email-roy.qing.li@gmail.com>
Download mbox | patch
Permalink /patch/142414/
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>
---
 drivers/net/ethernet/broadcom/cnic.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
David Miller - Feb. 22, 2012, 7:50 p.m.
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.
--
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/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