Commit fcca143d696092110ae1e361866576804fe887f3

Authored by Wei Yongjun
Committed by David S. Miller
1 parent 14109a59ca

rtnetlink: fix error return code in rtnl_link_fill()

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

net/core/rtnetlink.c
... ... @@ -496,8 +496,10 @@
496 496 }
497 497 if (ops->fill_info) {
498 498 data = nla_nest_start(skb, IFLA_INFO_DATA);
499   - if (data == NULL)
  499 + if (data == NULL) {
  500 + err = -EMSGSIZE;
500 501 goto err_cancel_link;
  502 + }
501 503 err = ops->fill_info(skb, dev);
502 504 if (err < 0)
503 505 goto err_cancel_data;