* [PATCH] ip: fix error handling in ip_finish_output2()
@ 2012-08-06 13:55 Vasily Kulikov
2012-08-06 20:32 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Vasily Kulikov @ 2012-08-06 13:55 UTC (permalink / raw)
To: David S. Miller
Cc: Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, netdev, linux-kernel
__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.
Signed-off-by: Vasily Kulikov <segoon@openwall.com>
---
Compile tested only.
net/ipv4/ip_output.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index ba39a52..76dde25 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -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();
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ip: fix error handling in ip_finish_output2()
2012-08-06 13:55 [PATCH] ip: fix error handling in ip_finish_output2() Vasily Kulikov
@ 2012-08-06 20:32 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-08-06 20:32 UTC (permalink / raw)
To: segoon; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
From: Vasily Kulikov <segoon@openwall.com>
Date: Mon, 6 Aug 2012 17:55:29 +0400
> __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.
>
> Signed-off-by: Vasily Kulikov <segoon@openwall.com>
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-06 20:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-06 13:55 [PATCH] ip: fix error handling in ip_finish_output2() Vasily Kulikov
2012-08-06 20:32 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).