Commit 7a0189390ed2eecfc928017ec8696d0cf80c24c7

Authored by Roopa Prabhu
Committed by Greg Kroah-Hartman
1 parent db4d24bc7f

bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify

[ Upstream commit 59ccaaaa49b5b096cdc1f16706a9f931416b2332 ]

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.

v2: rebase patch on net tree

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

net/core/rtnetlink.c
... ... @@ -2770,12 +2770,16 @@
2770 2770 goto errout;
2771 2771 }
2772 2772  
  2773 + if (!skb->len)
  2774 + goto errout;
  2775 +
2773 2776 rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
2774 2777 return 0;
2775 2778 errout:
2776 2779 WARN_ON(err == -EMSGSIZE);
2777 2780 kfree_skb(skb);
2778   - rtnl_set_sk_err(net, RTNLGRP_LINK, err);
  2781 + if (err)
  2782 + rtnl_set_sk_err(net, RTNLGRP_LINK, err);
2779 2783 return err;
2780 2784 }
2781 2785