netlink: Use netlink header as base to calculate bad attribute offset
[ Upstream commit84b3268027
] Userspace might send a batch that is composed of several netlink messages. The netlink_ack() function must use the pointer to the netlink header as base to calculate the bad attribute offset. Fixes:2d4bc93368
("netlink: extended ACK reporting") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
608f54653e
commit
04f430a90b
|
@ -2434,7 +2434,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
|
||||||
in_skb->len))
|
in_skb->len))
|
||||||
WARN_ON(nla_put_u32(skb, NLMSGERR_ATTR_OFFS,
|
WARN_ON(nla_put_u32(skb, NLMSGERR_ATTR_OFFS,
|
||||||
(u8 *)extack->bad_attr -
|
(u8 *)extack->bad_attr -
|
||||||
in_skb->data));
|
(u8 *)nlh));
|
||||||
} else {
|
} else {
|
||||||
if (extack->cookie_len)
|
if (extack->cookie_len)
|
||||||
WARN_ON(nla_put(skb, NLMSGERR_ATTR_COOKIE,
|
WARN_ON(nla_put(skb, NLMSGERR_ATTR_COOKIE,
|
||||||
|
|
Loading…
Reference in New Issue