Commit 5d620266 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[IPv6] address: Convert address notification 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 f21c7bc5
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#include <net/addrconf.h> #include <net/addrconf.h>
#include <net/tcp.h> #include <net/tcp.h>
#include <net/ip.h> #include <net/ip.h>
#include <net/netlink.h>
#include <linux/if_tunnel.h> #include <linux/if_tunnel.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
...@@ -3280,20 +3281,23 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, ...@@ -3280,20 +3281,23 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb,
static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
{ {
struct sk_buff *skb; struct sk_buff *skb;
int size = NLMSG_SPACE(sizeof(struct ifaddrmsg) + INET6_IFADDR_RTA_SPACE); int payload = sizeof(struct ifaddrmsg) + INET6_IFADDR_RTA_SPACE;
int err = -ENOBUFS;
skb = alloc_skb(size, GFP_ATOMIC); skb = nlmsg_new(nlmsg_total_size(payload), GFP_ATOMIC);
if (!skb) { if (skb == NULL)
netlink_set_err(rtnl, 0, RTNLGRP_IPV6_IFADDR, ENOBUFS); goto errout;
return;
} err = inet6_fill_ifaddr(skb, ifa, 0, 0, event, 0);
if (inet6_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) { if (err < 0) {
kfree_skb(skb); kfree_skb(skb);
netlink_set_err(rtnl, 0, RTNLGRP_IPV6_IFADDR, EINVAL); goto errout;
return;
} }
NETLINK_CB(skb).dst_group = RTNLGRP_IPV6_IFADDR;
netlink_broadcast(rtnl, skb, 0, RTNLGRP_IPV6_IFADDR, GFP_ATOMIC); err = rtnl_notify(skb, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC);
errout:
if (err < 0)
rtnl_set_sk_err(RTNLGRP_IPV6_IFADDR, err);
} }
static void inline ipv6_store_devconf(struct ipv6_devconf *cnf, static void inline ipv6_store_devconf(struct ipv6_devconf *cnf,
......
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