Patchwork [net-2.6,2/3] net: fix nlmsg len size for skb when error bit is set.

mail settings
Submitter Jeff Kirsher
Date Sept. 25, 2009, 11:11 p.m.
Message ID <20090925231144.23450.79736.stgit@localhost.localdomain>
Download mbox | patch
Permalink /patch/34326/
State Accepted
Delegated to: David Miller
Headers show


Jeff Kirsher - Sept. 25, 2009, 11:11 p.m.
From: John Fastabend <>

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 <>
Signed-off-by: Jeff Kirsher <>

 net/netlink/af_netlink.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at


diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a4bafbf..dd85320 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -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));