On Thu, 2017-01-05 at 23:21 -0500, Michael Chan wrote:
Some callers take rtnl_lock() before calling dev_get_stats() and some
don't. Most network drivers expect the ndo_get_stats64() to be called
under rtnl_lock() to avoid race conditions with device close or ethtool
reconfigurations. Fix it so that all callers take rtnl_lock().
Rename the original dev_get_stats() as __dev_get_stats() and add a new
dev_get_stats() that takes rtnl_lock() before calling __dev_get_stats().
Modify all callers that already take rtnl_lock() to call __dev_get_stats().
This makes no sense to me.
RTNL is absolutely not needed to get device stats.
We try to not add RTNL, especially when not required.
Sure, RTNETLINK dumps currently hold RTNL, but we had various attempts
in the past to get rid of this behavior.
If a device driver expects RTNL being locked, it is clearly a bug that
needs a fix anyway.