Netdev List
 help / color / mirror / Atom feed
From: roopa@cumulusnetworks.com
To: netdev@vger.kernel.org, stephen@networkplumber.org, rami.rosen@intel.com
Subject: [PATCH] bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify
Date: Tue, 27 Jan 2015 21:46:24 -0800	[thread overview]
Message-ID: <1422423984-29743-1-git-send-email-roopa@cumulusnetworks.com> (raw)

From: Roopa Prabhu <roopa@cumulusnetworks.com>

Reported in: https://bugzilla.kernel.org/show_bug.cgi?id=92081

This patch avoids calling rtnl_notify if the device ndo_bridge_getlink
handler does not return any bytes in the skb.

Alternately, the skb->len check can be moved inside rtnl_notify.

For the bridge vlan case described in 92081, there is also a fix needed
in bridge driver to generate a proper notification. Will fix that in
subsequent patch.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 net/core/rtnetlink.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 07447d1..e9d0f86 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2934,7 +2934,7 @@ static int rtnl_bridge_notify(struct net_device *dev)
 	}
 
 	err = dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev, 0);
-	if (err < 0)
+	if (err < 0 || !skb->len)
 		goto errout;
 
 	rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
@@ -2942,7 +2942,8 @@ static int rtnl_bridge_notify(struct net_device *dev)
 errout:
 	WARN_ON(err == -EMSGSIZE);
 	kfree_skb(skb);
-	rtnl_set_sk_err(net, RTNLGRP_LINK, err);
+	if (err)
+		rtnl_set_sk_err(net, RTNLGRP_LINK, err);
 	return err;
 }
 
-- 
1.7.10.4

             reply	other threads:[~2015-01-28  5:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28  5:46 roopa [this message]
2015-01-28  7:05 ` [PATCH] bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify David Miller
2015-01-28 13:37   ` roopa
2015-01-28 14:01     ` roopa

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=1422423984-29743-1-git-send-email-roopa@cumulusnetworks.com \
    --to=roopa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    --cc=rami.rosen@intel.com \
    --cc=stephen@networkplumber.org \
    /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