diff options
-rw-r--r-- | net/bridge/br_netlink.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 53086fb75089..8f661195d09d 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/rtnetlink.h> | 14 | #include <linux/rtnetlink.h> |
15 | #include <net/netlink.h> | ||
15 | #include "br_private.h" | 16 | #include "br_private.h" |
16 | 17 | ||
17 | /* | 18 | /* |
@@ -76,26 +77,24 @@ rtattr_failure: | |||
76 | void br_ifinfo_notify(int event, struct net_bridge_port *port) | 77 | void br_ifinfo_notify(int event, struct net_bridge_port *port) |
77 | { | 78 | { |
78 | struct sk_buff *skb; | 79 | struct sk_buff *skb; |
79 | int err = -ENOMEM; | 80 | int payload = sizeof(struct ifinfomsg) + 128; |
81 | int err = -ENOBUFS; | ||
80 | 82 | ||
81 | pr_debug("bridge notify event=%d\n", event); | 83 | pr_debug("bridge notify event=%d\n", event); |
82 | skb = alloc_skb(NLMSG_SPACE(sizeof(struct ifinfomsg) + 128), | 84 | skb = nlmsg_new(nlmsg_total_size(payload), GFP_ATOMIC); |
83 | GFP_ATOMIC); | 85 | if (skb == NULL) |
84 | if (!skb) | 86 | goto errout; |
85 | goto err_out; | 87 | |
88 | err = br_fill_ifinfo(skb, port, 0, 0, event, 0); | ||
89 | if (err < 0) { | ||
90 | kfree_skb(skb); | ||
91 | goto errout; | ||
92 | } | ||
86 | 93 | ||
87 | err = br_fill_ifinfo(skb, port, current->pid, 0, event, 0); | 94 | err = rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); |
95 | errout: | ||
88 | if (err < 0) | 96 | if (err < 0) |
89 | goto err_kfree; | 97 | rtnl_set_sk_err(RTNLGRP_LINK, err); |
90 | |||
91 | NETLINK_CB(skb).dst_group = RTNLGRP_LINK; | ||
92 | netlink_broadcast(rtnl, skb, 0, RTNLGRP_LINK, GFP_ATOMIC); | ||
93 | return; | ||
94 | |||
95 | err_kfree: | ||
96 | kfree_skb(skb); | ||
97 | err_out: | ||
98 | netlink_set_err(rtnl, 0, RTNLGRP_LINK, err); | ||
99 | } | 98 | } |
100 | 99 | ||
101 | /* | 100 | /* |