public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kbuild@lists.01.org, "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	lkp@intel.com, kbuild-all@lists.01.org, netdev@vger.kernel.org,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Eric Dumazet <edumazet@google.com>,
	George McCollister <george.mccollister@gmail.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>
Subject: Re: [PATCH v5 net-next 11/16] net: propagate errors from dev_get_stats
Date: Mon, 11 Jan 2021 13:03:33 +0200	[thread overview]
Message-ID: <20210111110333.zr6tpqpc7ckzy3gx@skbuf> (raw)
In-Reply-To: <20210111105515.GE5083@kadam>

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-olteanv@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	other threads:[~2021-01-11 11:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 16:31 [PATCH v5 net-next 00/16] Make .ndo_get_stats64 sleepable Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 01/16] net: mark dev_base_lock for deprecation Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 02/16] net: introduce a mutex for the netns interface lists Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 03/16] net: procfs: hold netif_lists_lock when retrieving device statistics Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 04/16] net: sysfs: don't hold dev_base_lock while " Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 05/16] s390/appldata_net_sum: hold the netdev lists lock when " Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 06/16] parisc/led: " Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 07/16] net: remove return value from dev_get_stats Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 08/16] net: allow ndo_get_stats64 to return an int error code Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 09/16] scsi: fcoe: propagate errors from dev_get_stats Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 10/16] net: openvswitch: " Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 11/16] net: " Vladimir Oltean
2021-01-08 17:22   ` Vladimir Oltean
2021-01-11 10:55   ` Dan Carpenter
2021-01-11 11:03     ` Vladimir Oltean [this message]
2021-01-08 16:31 ` [PATCH v5 net-next 12/16] net: terminate " Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 13/16] net: openvswitch: ensure dev_get_stats can sleep Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 14/16] net: net_failover: ensure .ndo_get_stats64 " Vladimir Oltean
2021-01-08 16:31 ` [PATCH v5 net-next 15/16] net: bonding: " Vladimir Oltean
2021-01-09  1:43   ` Jakub Kicinski
2021-01-08 16:31 ` [PATCH v5 net-next 16/16] net: mark ndo_get_stats64 as being able to sleep Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210111110333.zr6tpqpc7ckzy3gx@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=george.mccollister@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=kuba@kernel.org \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=stephen@networkplumber.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox