Hi Dan,

On Mon, Jan 11, 2021 at 01:55:16PM +0300, Dan Carpenter wrote:
> Hi Vladimir,
>
> New smatch warnings:
> net/core/rtnetlink.c:1821 rtnl_fill_ifinfo() warn: missing error code 'err'
>
> vim +/err +1821 net/core/rtnetlink.c
>
> static int rtnl_fill_ifinfo(struct sk_buff *skb,
>                           struct net_device *dev, struct net *src_net,
>                           int type, u32 pid, u32 seq, u32 change,
>                           unsigned int flags, u32 ext_filter_mask,
>                           u32 event, int *new_nsid, int new_ifindex,
>                           int tgt_netnsid, gfp_t gfp)
> {
>       struct ifinfomsg *ifm;
>       struct nlmsghdr *nlh;
>       int err = -EMSGSIZE;
>
...
>
>       err = rtnl_fill_stats(skb, dev);
>       if (err)
>               goto nla_put_failure;
>
>       if (rtnl_fill_vf(skb, dev, ext_filter_mask))
>               goto nla_put_failure;
>
> No error codes any more on the rest of the gotos in this function.
>
>
>       if (rtnl_port_fill(skb, dev, ext_filter_mask))
>               goto nla_put_failure;
>
>       if (rtnl_xdp_fill(skb, dev))
>               goto nla_put_failure;
>
...
>
>       nlmsg_end(skb, nlh);
>       return 0;
>
> nla_put_failure_rcu:
>       rcu_read_unlock();
> nla_put_failure:
>       nlmsg_cancel(skb, nlh);
>       return err;
> }

Thank you for this report. It is a valid issue. It has also been fixed
in v6:
https://patchwork.kernel.org/project/netdevbpf/patch/20210109172624.2028156-12-olte...@gmail.com/
>From the changelog:

Changes in v6:
- Fixed rtnetlink incorrectly returning 0 in rtnl_fill_ifinfo on
  nla_put_failure and causing "ip a" to not show any interfaces.

Reply via email to