since a v3 is coming another small cleanup ... On 4/8/17 2:34 PM, Johannes Berg wrote: > diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c > index c74f56a4fcf1..98e55a59c97e 100644 > --- a/net/netlink/af_netlink.c > +++ b/net/netlink/af_netlink.c > @@ -2336,20 +2339,27 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, > !(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)); > + if (nlk->flags & NETLINK_F_EXT_ACK) { > + if (err && extack) { push the extack into the flags if check > + 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)); > + } else if (!err && extack) { and here too > + if (extack->cookie_len) > + WARN_ON(nla_put(skb, NLMSGERR_ATTR_COOKIE, > + extack->cookie_len, > + extack->cookie)); > + }