Skip to contentSkip to conversation

ip: fix error handling in ip_finish_output2()

PATCH Applied Vasily Kulikov 2 participants 2 messages Aug 6, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 a263b3093641fb1ec377582c90986a7fd0625184.

---
Compile tested only.

 net/ipv4/ip_output.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv4/ip_output.c +1 -1
index ba39a52..76dde25 100644
@@ -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();
Signature · 1 line
1.7.0.4
maintainer Applied
#1 lore raw

From: Vasily Kulikov <[email protected]>
Date: Mon, 6 Aug 2012 17:55:29 +0400

Quoted 7 lines

__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 a263b3093641fb1ec377582c90986a7fd0625184.

Applied.

Please provide the proper commit log header line text when referencing another commit, otherwise in trees where the SHA1 IDs are different, nobody will be able to figure out what you are trying to refer to.

Thanks.