netlink: extack needs to be reset each time through loop
Subsystems (2)
PATCH 1/1 netlink: extack needs to be reset each time through loop
syzbot triggered the WARN_ON in netlink_ack testing the bad_attr value. The problem is that netlink_rcv_skb loops over the skb repeatedly invoking the callback and without resetting the extack leaving potentially stale data. Initializing each time through avoids the WARN_ON.
Fixes 2d4bc93368f5a ("netlink: extended ACK reporting")
Reported-by [email protected]
Signed-off-by David Ahern <[email protected]>
--- net/netlink/af_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netlink/af_netlink.c +2 -1
@@ -2417,7 +2417,7 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *, struct nlmsghdr *, struct netlink_ext_ack *)) { -struct netlink_ext_ack extack = {}; +struct netlink_ext_ack extack;struct nlmsghdr *nlh;int err;
@@ -2438,6 +2438,7 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,if (nlh->nlmsg_type <NLMSG_MIN_TYPE ) goto ack; +memset (&extack,0 ,sizeof (extack)); err =cb (skb, nlh, &extack);if (err == -EINTR ) goto skip;
Signature · 1 line
2.11.0
David Miller
maintainerFrom: David Ahern <[email protected]>
Date: Wed, 10 Jan 2018 13:00:39 -0800
Quoted 8 lines
syzbot triggered the
WARN_ONinnetlink_acktesting thebad_attrvalue. The problem is thatnetlink_rcv_skbloops over the skb repeatedly invoking the callback and without resetting the extack leaving potentially stale data. Initializing each time through avoids theWARN_ON.Fixes 2d4bc93368f5a ("netlink: extended ACK reporting")Reported-by [email protected]Signed-off-by David Ahern <[email protected]>
Applied and queued up for -stable, thanks David.