mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 12:21:37 +00:00
[NETLINK]: Set correct pid for ioctl originating netlink events
This patch ensures that netlink events created as a result of programns using ioctls (such as ifconfig, route etc) contains the correct PID of those events. Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e431b8c004
commit
9ed19f339e
@ -452,7 +452,7 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
|
||||
if (!skb)
|
||||
return;
|
||||
|
||||
if (rtnetlink_fill_ifinfo(skb, dev, type, 0, 0, change, 0) < 0) {
|
||||
if (rtnetlink_fill_ifinfo(skb, dev, type, current->pid, 0, change, 0) < 0) {
|
||||
kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
|
@ -1112,7 +1112,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa)
|
||||
|
||||
if (!skb)
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, ENOBUFS);
|
||||
else if (inet_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
|
||||
else if (inet_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
|
||||
kfree_skb(skb);
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, EINVAL);
|
||||
} else {
|
||||
|
@ -276,7 +276,7 @@ void rtmsg_fib(int event, u32 key, struct fib_alias *fa,
|
||||
struct nlmsghdr *n, struct netlink_skb_parms *req)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
u32 pid = req ? req->pid : 0;
|
||||
u32 pid = req ? req->pid : n->nlmsg_pid;
|
||||
int size = NLMSG_SPACE(sizeof(struct rtmsg)+256);
|
||||
|
||||
skb = alloc_skb(size, GFP_KERNEL);
|
||||
@ -1035,7 +1035,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm,
|
||||
}
|
||||
|
||||
nl->nlmsg_flags = NLM_F_REQUEST;
|
||||
nl->nlmsg_pid = 0;
|
||||
nl->nlmsg_pid = current->pid;
|
||||
nl->nlmsg_seq = 0;
|
||||
nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm));
|
||||
if (cmd == SIOCDELRT) {
|
||||
|
@ -2873,7 +2873,7 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, ENOBUFS);
|
||||
return;
|
||||
}
|
||||
if (inet6_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
|
||||
if (inet6_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
|
||||
kfree_skb(skb);
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, EINVAL);
|
||||
return;
|
||||
@ -3008,7 +3008,7 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, ENOBUFS);
|
||||
return;
|
||||
}
|
||||
if (inet6_fill_ifinfo(skb, idev, 0, 0, event, 0) < 0) {
|
||||
if (inet6_fill_ifinfo(skb, idev, current->pid, 0, event, 0) < 0) {
|
||||
kfree_skb(skb);
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, EINVAL);
|
||||
return;
|
||||
@ -3065,7 +3065,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, ENOBUFS);
|
||||
return;
|
||||
}
|
||||
if (inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0) < 0) {
|
||||
if (inet6_fill_prefix(skb, idev, pinfo, current->pid, 0, event, 0) < 0) {
|
||||
kfree_skb(skb);
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, EINVAL);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user