> @@ -2300,14 +2332,35 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) rep = __nlmsg_put(skb, NETLINK_CB(in_skb).portid, nlh->nlmsg_seq, > NLMSG_ERROR, payload, 0); > errmsg = nlmsg_data(rep); > errmsg->error = err; This is still wrong - now the message length is too short. At the very least, > - memcpy(&errmsg->msg, nlh, payload > sizeof(*errmsg) ? nlh- > >nlmsg_len : sizeof(*nlh)); > + memcpy(&errmsg->msg, nlh, > + !(nlk->flags & NETLINK_F_CAP_ACK) ? nlh->nlmsg_len > + : sizeof(*nlh)); > + > + if (err && nlk->flags & NETLINK_F_EXT_ACK && extack) { > + if (extack->_msg) > + WARN_ON(nla_put_string(skb, > NLMSGERR_ATTR_MSG, > + extack->_msg)); > + if (extack->bad_attr && > + !WARN_ON((u8 *)extack->bad_attr < in_skb->data > || > + (u8 *)extack->bad_attr >= in_skb->data > + > + in_skb->len)) > + WARN_ON(nla_put_u32(skb, NLMSGERR_ATTR_OFFS, > + (u8 *)extack->bad_attr - > + in_skb->data)); > + if (extack->missing_attr) > + WARN_ON(nla_put_u16(skb, NLMSGERR_ATTR_ATTR, > + extack->missing_attr)); > + } I need to add rep->nlmsg_len = skb->len; > netlink_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).portid, > MSG_DONTWAIT); Here, but at that point I think it makes sense to rewrite this nlmsg put stuff here as well. johannes