aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink/af_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/netlink/af_netlink.c')
-rw-r--r--net/netlink/af_netlink.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index d527c8977b1f..3baafb10f8f3 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1148,12 +1148,11 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
1148 if (len > sk->sk_sndbuf - 32) 1148 if (len > sk->sk_sndbuf - 32)
1149 goto out; 1149 goto out;
1150 err = -ENOBUFS; 1150 err = -ENOBUFS;
1151 skb = nlmsg_new(len, GFP_KERNEL); 1151 skb = alloc_skb(len, GFP_KERNEL);
1152 if (skb==NULL) 1152 if (skb==NULL)
1153 goto out; 1153 goto out;
1154 1154
1155 NETLINK_CB(skb).pid = nlk->pid; 1155 NETLINK_CB(skb).pid = nlk->pid;
1156 NETLINK_CB(skb).dst_pid = dst_pid;
1157 NETLINK_CB(skb).dst_group = dst_group; 1156 NETLINK_CB(skb).dst_group = dst_group;
1158 NETLINK_CB(skb).loginuid = audit_get_loginuid(current->audit_context); 1157 NETLINK_CB(skb).loginuid = audit_get_loginuid(current->audit_context);
1159 selinux_get_task_sid(current, &(NETLINK_CB(skb).sid)); 1158 selinux_get_task_sid(current, &(NETLINK_CB(skb).sid));
@@ -1435,14 +1434,13 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
1435 struct sk_buff *skb; 1434 struct sk_buff *skb;
1436 struct nlmsghdr *rep; 1435 struct nlmsghdr *rep;
1437 struct nlmsgerr *errmsg; 1436 struct nlmsgerr *errmsg;
1438 int size; 1437 size_t payload = sizeof(*errmsg);
1439 1438
1440 if (err == 0) 1439 /* error messages get the original request appened */
1441 size = nlmsg_total_size(sizeof(*errmsg)); 1440 if (err)
1442 else 1441 payload += nlmsg_len(nlh);
1443 size = nlmsg_total_size(sizeof(*errmsg) + nlmsg_len(nlh));
1444 1442
1445 skb = nlmsg_new(size, GFP_KERNEL); 1443 skb = nlmsg_new(payload, GFP_KERNEL);
1446 if (!skb) { 1444 if (!skb) {
1447 struct sock *sk; 1445 struct sock *sk;
1448 1446