Re: [PATCH net v2] devlink: Hold devlink lock on health reporter dump get

From: Przemek Kitszel
Date: Thu Oct 05 2023 - 10:48:10 EST


On 10/5/23 14:50, Moshe Shemesh wrote:
Devlink health dump get callback should take devlink lock as any other
devlink callback. Otherwise, since devlink_mutex was removed, this
callback is not protected from a race of the reporter being destroyed
while handling the callback.

Add devlink lock to the callback and to any call for
devlink_health_do_dump(). This should be safe as non of the drivers dump
callback implementation takes devlink lock.

As devlink lock is added to any callback of dump, the reporter dump_lock
is now redundant and can be removed.

Fixes: d3efc2a6a6d8 ("net: devlink: remove devlink_mutex")
Signed-off-by: Moshe Shemesh <moshe@xxxxxxxxxx>
Reviewed-by: Jiri Pirko <jiri@xxxxxxxxxx>
---
v1->v2:
- Commit message, added why this fix is necessary and why its safe to do.
---
net/devlink/health.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)


Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>