All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, ssujith@cisco.com, neepatel@cisco.com,
	benve@cisco.com, davem@davemloft.net, ben@decadent.org.uk,
	govindarajulu90@gmail.com, gregory.v.rose@intel.com
Subject: Re: [PATCH 2/2] rtnetlink: Only supply IFLA_VF_PORTS information when RTEXT_FILTER_VF is set
Date: Thu, 24 Apr 2014 10:13:14 +1000	[thread overview]
Message-ID: <20140424001314.GD31647@voom.fritz.box> (raw)
In-Reply-To: <20140423091715.GD2846@minipsycho.orion>

[-- Attachment #1: Type: text/plain, Size: 2986 bytes --]

On Wed, Apr 23, 2014 at 11:17:15AM +0200, Jiri Pirko wrote:
> Wed, Apr 23, 2014 at 09:21:05AM CEST, david@gibson.dropbear.id.au wrote:
> >Since 115c9b81928360d769a76c632bae62d15206a94a (rtnetlink: Fix problem with
> >buffer allocation), RTM_NEWLINK messages only contain the IFLA_VFINFO_LIST
> >attribute if they were solicited by a GETLINK message containing an
> >IFLA_EXT_MASK attribute with the RTEXT_FILTER_VF flag.
> >
> >That was done because some user programs broke when they received more data
> >than expected - because IFLA_VFINFO_LIST contains information for each VF
> >it can become large if there are many VFs.
> >
> >However, the IFLA_VF_PORTS attribute, supplied for devices which implement
> >ndo_get_vf_port (currently the 'enic' driver only), has the same problem.
> >It supplies per-VF information and can therefore become large, but it is
> >not currently conditional on the IFLA_EXT_MASK value.
> >
> >Worse, it interacts badly with the existing EXT_MASK handling.  When
> >IFLA_EXT_MASK is not supplied, the buffer for netlink replies is fixed at
> >NLMSG_GOODSIZE.  If the information for IFLA_VF_PORTS exceeds this, then
> >rtnl_fill_ifinfo() returns -EMSGSIZE on the first message in a packet.
> >netlink_dump() will misinterpret this as having finished the listing and
> >omit data for this interface and all subsequent ones.  That can cause
> >getifaddrs(3) to enter an infinite loop.
> >
> >This patch addresses the problem by only supplying IFLA_VF_PORTS when
> >IFLA_EXT_MASK is supplied with the RTEXT_FILTER_VF flag set.
> >
> >Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> >---
> > net/core/rtnetlink.c | 16 ++++++++++------
> > 1 file changed, 10 insertions(+), 6 deletions(-)
> >
> >diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> >index 5331db2..32a1287 100644
> >--- a/net/core/rtnetlink.c
> >+++ b/net/core/rtnetlink.c
> >@@ -774,7 +774,8 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
> > 		return 0;
> > }
> > 
> >-static size_t rtnl_port_size(const struct net_device *dev)
> >+static size_t rtnl_port_size(const struct net_device *dev,
> >+			     u32 ext_filter_mask)
> > {
> > 	size_t port_size = nla_total_size(4)		/* PORT_VF */
> > 		+ nla_total_size(PORT_PROFILE_MAX)	/* PORT_PROFILE */
> >@@ -790,7 +791,8 @@ static size_t rtnl_port_size(const struct net_device *dev)
> > 	size_t port_self_size = nla_total_size(sizeof(struct nlattr))
> > 		+ port_size;
> > 
> >-	if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent)
> >+	if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent
> >+	    || !(ext_filter_mask & RTEXT_FILTER_VF))
> 
> 	Do not start line with ||

Ah, sorry, I'm getting my project codingstyles mixed up.  Will fix.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-04-24  0:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23  7:21 [0/2] Fix problems with with IFLA_VF_PORTS David Gibson
2014-04-23  7:21 ` [PATCH 1/2] rtnetlink: Warn when interface's information won't fit in our packet David Gibson
2014-04-23  9:09   ` Jiri Pirko
2014-04-23 11:41     ` David Gibson
2014-04-23 11:51       ` Jiri Pirko
2014-04-23 14:20   ` Sergei Shtylyov
2014-04-23  7:21 ` [PATCH 2/2] rtnetlink: Only supply IFLA_VF_PORTS information when RTEXT_FILTER_VF is set David Gibson
2014-04-23  9:17   ` Jiri Pirko
2014-04-24  0:13     ` David Gibson [this message]
2014-04-23 15:14 ` [0/2] Fix problems with with IFLA_VF_PORTS Greg Rose
  -- strict thread matches above, loose matches on Subject: below --
2014-04-24  0:22 [0/2] Fix problems with with IFLA_VF_PORTS (v2) David Gibson
2014-04-24  0:22 ` [PATCH 2/2] rtnetlink: Only supply IFLA_VF_PORTS information when RTEXT_FILTER_VF is set David Gibson
2014-04-24 15:51   ` Jiri Pirko

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=20140424001314.GD31647@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=ben@decadent.org.uk \
    --cc=benve@cisco.com \
    --cc=davem@davemloft.net \
    --cc=govindarajulu90@gmail.com \
    --cc=gregory.v.rose@intel.com \
    --cc=jiri@resnulli.us \
    --cc=neepatel@cisco.com \
    --cc=netdev@vger.kernel.org \
    --cc=ssujith@cisco.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.