net: fix nlmsg len size for skb when error bit is set.
authorJohn Fastabend <john.r.fastabend@intel.com>
Fri, 25 Sep 2009 13:11:44 +0000 (13:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 27 Sep 2009 03:16:11 +0000 (20:16 -0700)
Currently, the nlmsg->len field is not set correctly in  netlink_ack()
for ack messages that include the nlmsg of the error frame.  This
corrects the length field passed to __nlmsg_put to use the correct
payload size.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/af_netlink.c

index a4bafbf150974da5daa3ba622f10b7b589604272..dd85320907cb6f765346f12bd34335825287a743 100644 (file)
@@ -1788,7 +1788,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
        }
 
        rep = __nlmsg_put(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
-                         NLMSG_ERROR, sizeof(struct nlmsgerr), 0);
+                         NLMSG_ERROR, payload, 0);
        errmsg = nlmsg_data(rep);
        errmsg->error = err;
        memcpy(&errmsg->msg, nlh, err ? nlh->nlmsg_len : sizeof(*nlh));