ipmr_update_thresholds() and ip6mr_update_thresholds() read the VIF/MIF table and are documented to run under mrt_lock. Both MFC add functions take the lock for an existing entry but not for a new one. That was fine while MFC and VIF/MIF updates were all serialized by RTNL. The MFC paths now use dedicated mutexes: IPv4 rtnetlink since commit bddafc06ca5e ("ipmr: Don't hold RTNL for ipmr_rtm_route().") and IPv6 setsockopt since commit a4c98421720a ("ip6mr: Replace RTNL with a dedicated mutex for MFC."). So a new entry can be filled from a table that changes during the scan. Patch 1 fixes IPv4 and patch 2 IPv6. They are split because the Fixes commits landed in different releases (v7.1 and v7.2). Found by a static analysis tool (Clang context analysis on the locking rule in the comment); the IPv6 twin was then found by inspection. Not triggered; build-tested only. Praneeth Balasubramanian (2): ipmr: Take mrt_lock when filling the output list of a new MFC entry ip6mr: Take mrt_lock when filling the output list of a new MFC entry net/ipv4/ipmr.c | 2 ++ net/ipv6/ip6mr.c | 2 ++ 2 files changed, 4 insertions(+)
-- 2.25.1