mirror_ubuntu-kernels/drivers/net/dsa/hirschmann
Vladimir Oltean cd391280bf net: dsa: hellcreek: fix broken backpressure in .port_fdb_dump
rtnl_fdb_dump() has logic to split a dump of PF_BRIDGE neighbors into
multiple netlink skbs if the buffer provided by user space is too small
(one buffer will typically handle a few hundred FDB entries).

When the current buffer becomes full, nlmsg_put() in
dsa_slave_port_fdb_do_dump() returns -EMSGSIZE and DSA saves the index
of the last dumped FDB entry, returns to rtnl_fdb_dump() up to that
point, and then the dump resumes on the same port with a new skb, and
FDB entries up to the saved index are simply skipped.

Since dsa_slave_port_fdb_do_dump() is pointed to by the "cb" passed to
drivers, then drivers must check for the -EMSGSIZE error code returned
by it. Otherwise, when a netlink skb becomes full, DSA will no longer
save newly dumped FDB entries to it, but the driver will continue
dumping. So FDB entries will be missing from the dump.

Fix the broken backpressure by propagating the "cb" return code and
allow rtnl_fdb_dump() to restart the FDB dump with a new skb.

Fixes: e4b27ebc78 ("net: dsa: Add DSA driver for Hirschmann Hellcreek switches")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-08-10 13:17:22 +01:00
..
hellcreek_hwtstamp.c net: dsa: no longer clone skb in core driver 2021-04-27 14:10:15 -07:00
hellcreek_hwtstamp.h net: dsa: no longer clone skb in core driver 2021-04-27 14:10:15 -07:00
hellcreek_ptp.c net: dsa: hellcreek: Add PTP status LEDs 2020-11-05 14:04:50 -08:00
hellcreek_ptp.h net: dsa: hellcreek: Add PTP status LEDs 2020-11-05 14:04:50 -08:00
hellcreek.c net: dsa: hellcreek: fix broken backpressure in .port_fdb_dump 2021-08-10 13:17:22 +01:00
hellcreek.h net: dsa: hellcreek: Add devlink FDB region 2021-03-13 14:30:48 -08:00
Kconfig net: dsa: hellcreek: Add missing TAPRIO dependency 2021-01-29 21:02:31 -08:00
Makefile net: dsa: hellcreek: Add support for hardware timestamping 2020-11-05 14:04:49 -08:00