All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/3] net-sysfs: fix race conditions in the xps code
@ 2020-12-21 19:36 Antoine Tenart
  2020-12-21 19:36 ` [PATCH net v2 1/3] net: fix race conditions in xps by locking the maps and dev->tc_num Antoine Tenart
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Antoine Tenart @ 2020-12-21 19:36 UTC (permalink / raw)
  To: davem, kuba, alexander.duyck; +Cc: Antoine Tenart, netdev, pabeni

Hello all,

This series fixes race conditions in the xps code, where out of bound
accesses can occur when dev->num_tc is updated, triggering oops. The
root cause is linked to lock issues. An explanation is given in each of
the commit logs.

Reviews in v1 suggested to use the xps_map_mutex to protect the maps and
their related parameters instead of the rtnl lock. We followed this path
in v2 as it seems a better compromise than taking the rtnl lock.

As a result, patch 1 turned out to be less straight forward as some of
the locking logic in net/core/dev.c related to xps_map_mutex had to be
changed. Patches 2 and 3 are also larger in v2 as code had to be moved
from net/core/net-sysfs.c to net/core/dev.c to take the xps_map_mutex
(however maintainability is improved).

Also, while working on the v2 I stumbled upon another race condition. I
debugged it and the fix is the same as patch 1. I updated its commit log
to describe both races.

Thanks!
Antoine

Antoine Tenart (3):
  net: fix race conditions in xps by locking the maps and dev->tc_num
  net: move the xps cpus retrieval out of net-sysfs
  net: move the xps rxqs retrieval out of net-sysfs

 include/linux/netdevice.h |   9 ++
 net/core/dev.c            | 186 +++++++++++++++++++++++++++++---------
 net/core/net-sysfs.c      |  89 ++++--------------
 3 files changed, 171 insertions(+), 113 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-12-23 21:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 19:36 [PATCH net v2 0/3] net-sysfs: fix race conditions in the xps code Antoine Tenart
2020-12-21 19:36 ` [PATCH net v2 1/3] net: fix race conditions in xps by locking the maps and dev->tc_num Antoine Tenart
2020-12-21 23:21   ` Alexander Duyck
2020-12-22  9:21     ` Antoine Tenart
2020-12-22 16:12       ` Alexander Duyck
2020-12-23 18:27         ` Jakub Kicinski
2020-12-23 19:36           ` Antoine Tenart
2020-12-23 20:11             ` Jakub Kicinski
2020-12-23 20:35               ` Antoine Tenart
2020-12-23 20:43                 ` Jakub Kicinski
2020-12-23 20:56                   ` Antoine Tenart
2020-12-23 20:59                     ` Jakub Kicinski
2020-12-21 19:36 ` [PATCH net v2 2/3] net: move the xps cpus retrieval out of net-sysfs Antoine Tenart
2020-12-21 22:33   ` Alexander Duyck
2020-12-22  9:10     ` Antoine Tenart
2020-12-21 19:36 ` [PATCH net v2 3/3] net: move the xps rxqs " Antoine Tenart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.