Commit 280a306c authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[BRIDGE]: Convert notifications to use rtnl_notify()

Fixes a wrong use of current->pid as netlink pid.
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8c384bfa
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <net/netlink.h>
#include "br_private.h" #include "br_private.h"
/* /*
...@@ -76,26 +77,24 @@ static int br_fill_ifinfo(struct sk_buff *skb, const struct net_bridge_port *por ...@@ -76,26 +77,24 @@ static int br_fill_ifinfo(struct sk_buff *skb, const struct net_bridge_port *por
void br_ifinfo_notify(int event, struct net_bridge_port *port) void br_ifinfo_notify(int event, struct net_bridge_port *port)
{ {
struct sk_buff *skb; struct sk_buff *skb;
int err = -ENOMEM; int payload = sizeof(struct ifinfomsg) + 128;
int err = -ENOBUFS;
pr_debug("bridge notify event=%d\n", event); pr_debug("bridge notify event=%d\n", event);
skb = alloc_skb(NLMSG_SPACE(sizeof(struct ifinfomsg) + 128), skb = nlmsg_new(nlmsg_total_size(payload), GFP_ATOMIC);
GFP_ATOMIC); if (skb == NULL)
if (!skb) goto errout;
goto err_out;
err = br_fill_ifinfo(skb, port, 0, 0, event, 0);
if (err < 0) {
kfree_skb(skb);
goto errout;
}
err = br_fill_ifinfo(skb, port, current->pid, 0, event, 0); err = rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
errout:
if (err < 0) if (err < 0)
goto err_kfree; rtnl_set_sk_err(RTNLGRP_LINK, err);
NETLINK_CB(skb).dst_group = RTNLGRP_LINK;
netlink_broadcast(rtnl, skb, 0, RTNLGRP_LINK, GFP_ATOMIC);
return;
err_kfree:
kfree_skb(skb);
err_out:
netlink_set_err(rtnl, 0, RTNLGRP_LINK, err);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment