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.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index d527c8977b1f..f61d81b3c61c 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1148,7 +1148,7 @@ 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
@@ -1435,14 +1435,13 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
1435 struct sk_buff *skb; 1435 struct sk_buff *skb;
1436 struct nlmsghdr *rep; 1436 struct nlmsghdr *rep;
1437 struct nlmsgerr *errmsg; 1437 struct nlmsgerr *errmsg;
1438 int size; 1438 size_t payload = sizeof(*errmsg);
1439 1439
1440 if (err == 0) 1440 /* error messages get the original request appened */
1441 size = nlmsg_total_size(sizeof(*errmsg)); 1441 if (err)
1442 else 1442 payload += nlmsg_len(nlh);
1443 size = nlmsg_total_size(sizeof(*errmsg) + nlmsg_len(nlh));
1444 1443
1445 skb = nlmsg_new(size, GFP_KERNEL); 1444 skb = nlmsg_new(payload, GFP_KERNEL);
1446 if (!skb) { 1445 if (!skb) {
1447 struct sock *sk; 1446 struct sock *sk;
1448 1447