net: bridge: vlan: fix single net device option dumping
authorNikolay Aleksandrov <nikolay@nvidia.com>
Wed, 26 Jan 2022 13:10:25 +0000 (15:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Feb 2022 16:27:14 +0000 (17:27 +0100)
commit2387357199a096a332d9533822e606a511808cb6
tree25e21e13d5b5a204db575b1c2ba2ea2fbf197548
parente406345f8a26af5963936bc3aca32534adc30f16
net: bridge: vlan: fix single net device option dumping

[ Upstream commit dcb2c5c6ca9b9177f04abaf76e5a983d177c9414 ]

When dumping vlan options for a single net device we send the same
entries infinitely because user-space expects a 0 return at the end but
we keep returning skb->len and restarting the dump on retry. Fix it by
returning the value from br_vlan_dump_dev() if it completed or there was
an error. The only case that must return skb->len is when the dump was
incomplete and needs to continue (-EMSGSIZE).

Reported-by: Benjamin Poirier <bpoirier@nvidia.com>
Fixes: 8dcea187088b ("net: bridge: vlan: add rtm definitions and dump support")
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bridge/br_vlan.c