提交 9871f1ad 编写于 作者: V Vasiliy Kulikov 提交者: David S. Miller

ip: fix error handling in ip_finish_output2()

__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 a263b309
("ipv4: Make neigh lookups directly in output packet path.").
Signed-off-by: NVasily Kulikov <segoon@openwall.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 91d27a86
...@@ -197,7 +197,7 @@ static inline int ip_finish_output2(struct sk_buff *skb) ...@@ -197,7 +197,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
neigh = __ipv4_neigh_lookup_noref(dev, nexthop); neigh = __ipv4_neigh_lookup_noref(dev, nexthop);
if (unlikely(!neigh)) if (unlikely(!neigh))
neigh = __neigh_create(&arp_tbl, &nexthop, dev, false); neigh = __neigh_create(&arp_tbl, &nexthop, dev, false);
if (neigh) { if (!IS_ERR(neigh)) {
int res = dst_neigh_output(dst, neigh, skb); int res = dst_neigh_output(dst, neigh, skb);
rcu_read_unlock_bh(); rcu_read_unlock_bh();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册