Skip to content

Commit

Permalink
ipvlan: fix incorrect usage of IS_ERR() macro in IPv6 code path.
Browse files Browse the repository at this point in the history
The ip6_route_output() always returns a valid dst pointer unlike in IPv4
case. So the validation has to be different from the IPv4 path. Correcting
that error in this patch.

This was picked up by a static checker with a following warning -

   drivers/net/ipvlan/ipvlan_core.c:380 ipvlan_process_v6_outbound()
        warn: 'dst' isn't an ERR_PTR

Signed-off-by: Mahesh Bandewar <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Mahesh Bandewar authored and davem330 committed Jan 25, 2015
1 parent 6b8d911 commit 2aab952
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ipvlan/ipvlan_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,11 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
};

dst = ip6_route_output(dev_net(dev), NULL, &fl6);
if (IS_ERR(dst))
if (dst->error) {
ret = dst->error;
dst_release(dst);
goto err;

}
skb_dst_drop(skb);
skb_dst_set(skb, dst);
err = ip6_local_out(skb);
Expand Down

0 comments on commit 2aab952

Please sign in to comment.