netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtnetlink: fix error return code in rtnl_link_fill()
@ 2013-03-27 13:22 Wei Yongjun
  2013-03-27 18:10 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2013-03-27 13:22 UTC (permalink / raw)
  To: davem, john.r.fastabend, jiri, edumazet, vyasevic; +Cc: yongjun_wei, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Fix to return a negative error code from the error handling case
instead of 0(possible overwrite to 0 by ops->fill_xstats call),
as returned elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 net/core/rtnetlink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5fb8d7e..b65441d 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -496,8 +496,10 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
 	}
 	if (ops->fill_info) {
 		data = nla_nest_start(skb, IFLA_INFO_DATA);
-		if (data == NULL)
+		if (data == NULL) {
+			err = -EMSGSIZE;
 			goto err_cancel_link;
+		}
 		err = ops->fill_info(skb, dev);
 		if (err < 0)
 			goto err_cancel_data;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtnetlink: fix error return code in rtnl_link_fill()
  2013-03-27 13:22 [PATCH] rtnetlink: fix error return code in rtnl_link_fill() Wei Yongjun
@ 2013-03-27 18:10 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-03-27 18:10 UTC (permalink / raw)
  To: weiyj.lk; +Cc: john.r.fastabend, jiri, edumazet, vyasevic, yongjun_wei, netdev

From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Wed, 27 Mar 2013 21:22:45 +0800

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Fix to return a negative error code from the error handling case
> instead of 0(possible overwrite to 0 by ops->fill_xstats call),
> as returned elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-27 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 13:22 [PATCH] rtnetlink: fix error return code in rtnl_link_fill() Wei Yongjun
2013-03-27 18:10 ` 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).