ethernet/broadcom: ip6_route_output() never returns NULL.
authorRongQing.Li <roy.qing.li@gmail.com>
Tue, 21 Feb 2012 22:10:50 +0000 (22:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Feb 2012 20:30:14 +0000 (15:30 -0500)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/cnic.c

index dd3a0a232ea068a2970dec4054ad759ce6950704..818a573669e6b0b4cdd27fda3ca111ff6c133931 100644 (file)
@@ -3584,7 +3584,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