* [PATCH] ipv6: fix return value check in fib6_add()
@ 2012-09-21 4:29 Wei Yongjun
2012-09-21 17:44 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2012-09-21 4:29 UTC (permalink / raw)
To: davem, kuznet, jmorris, yoshfuji, kaber; +Cc: yongjun_wei, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
In case of error, the function fib6_add_1() returns ERR_PTR()
or NULL pointer. The ERR_PTR() case check is missing in fib6_add().
dpatch engine is used to generated this patch.
(https://github.com/weiyj/dpatch)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
net/ipv6/ip6_fib.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 13690d6..286acfc 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -819,6 +819,10 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info)
offsetof(struct rt6_info, rt6i_src),
allow_create, replace_required);
+ if (IS_ERR(sn)) {
+ err = PTR_ERR(sn);
+ sn = NULL;
+ }
if (!sn) {
/* If it is failed, discard just allocated
root, and then (in st_failure) stale node
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipv6: fix return value check in fib6_add()
2012-09-21 4:29 [PATCH] ipv6: fix return value check in fib6_add() Wei Yongjun
@ 2012-09-21 17:44 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-09-21 17:44 UTC (permalink / raw)
To: weiyj.lk; +Cc: kuznet, jmorris, yoshfuji, kaber, yongjun_wei, netdev
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Fri, 21 Sep 2012 12:29:56 +0800
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, the function fib6_add_1() returns ERR_PTR()
> or NULL pointer. The ERR_PTR() case check is missing in fib6_add().
>
> dpatch engine is used to generated this patch.
> (https://github.com/weiyj/dpatch)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Applied, thanks.
Longer term fib6_add_1() should consistently return errno pointers,
rather than a mixture of NULL and errno pointers.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-21 17:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21 4:29 [PATCH] ipv6: fix return value check in fib6_add() Wei Yongjun
2012-09-21 17:44 ` 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).