Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28633514 authored by Alexey Kuznetsov's avatar Alexey Kuznetsov Committed by David S. Miller
Browse files

[NETLINK]: illegal use of pid in rtnetlink



When a netlink message is not related to a netlink socket,
it is issued by kernel socket with pid 0. Netlink "pid" has nothing
to do with current->pid. I called it incorrectly, if it was named "port",
the confusion would be avoided.

Signed-off-by: default avatarAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a70ea994
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -455,7 +455,7 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
	if (!skb)
	if (!skb)
		return;
		return;


	if (rtnetlink_fill_ifinfo(skb, dev, type, current->pid, 0, change, 0) < 0) {
	if (rtnetlink_fill_ifinfo(skb, dev, type, 0, 0, change, 0) < 0) {
		kfree_skb(skb);
		kfree_skb(skb);
		return;
		return;
	}
	}
+1 −1
Original line number Original line Diff line number Diff line
@@ -1135,7 +1135,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa)


	if (!skb)
	if (!skb)
		netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS);
		netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS);
	else if (inet_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
	else if (inet_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
		kfree_skb(skb);
		kfree_skb(skb);
		netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL);
		netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL);
	} else {
	} else {
+1 −1
Original line number Original line Diff line number Diff line
@@ -1045,7 +1045,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm,
	}
	}


	nl->nlmsg_flags = NLM_F_REQUEST;
	nl->nlmsg_flags = NLM_F_REQUEST;
	nl->nlmsg_pid = current->pid;
	nl->nlmsg_pid = 0;
	nl->nlmsg_seq = 0;
	nl->nlmsg_seq = 0;
	nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm));
	nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm));
	if (cmd == SIOCDELRT) {
	if (cmd == SIOCDELRT) {