Skip to content

Commit

Permalink
ip: fix error handling in ip_finish_output2()
Browse files Browse the repository at this point in the history
__neigh_create() returns either a pointer to struct neighbour or PTR_ERR().
But the caller expects it to return either a pointer or NULL.  Replace
the NULL check with IS_ERR() check.

The bug was introduced in a263b30
("ipv4: Make neigh lookups directly in output packet path.").

Signed-off-by: Vasily Kulikov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
segoon authored and davem330 committed Aug 6, 2012
1 parent 91d27a8 commit 9871f1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/ip_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
neigh = __ipv4_neigh_lookup_noref(dev, nexthop);
if (unlikely(!neigh))
neigh = __neigh_create(&arp_tbl, &nexthop, dev, false);
if (neigh) {
if (!IS_ERR(neigh)) {
int res = dst_neigh_output(dst, neigh, skb);

rcu_read_unlock_bh();
Expand Down

0 comments on commit 9871f1a

Please sign in to comment.