mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
devlink: Protect devlink port list traversal
Cited patch in fixes tag misses to protect port list traversal
while traversing per port reporter list.
Protect it using devlink instance lock.
Fixes: f4f5416601
("devlink: Implement devlink health reporters on per-port basis")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
79604c5de2
commit
5d080b5064
@ -5895,6 +5895,7 @@ devlink_nl_cmd_health_reporter_get_dumpit(struct sk_buff *msg,
|
||||
list_for_each_entry(devlink, &devlink_list, list) {
|
||||
if (!net_eq(devlink_net(devlink), sock_net(msg->sk)))
|
||||
continue;
|
||||
mutex_lock(&devlink->lock);
|
||||
list_for_each_entry(port, &devlink->port_list, list) {
|
||||
mutex_lock(&port->reporters_lock);
|
||||
list_for_each_entry(reporter, &port->reporter_list, list) {
|
||||
@ -5909,12 +5910,14 @@ devlink_nl_cmd_health_reporter_get_dumpit(struct sk_buff *msg,
|
||||
NLM_F_MULTI);
|
||||
if (err) {
|
||||
mutex_unlock(&port->reporters_lock);
|
||||
mutex_unlock(&devlink->lock);
|
||||
goto out;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
mutex_unlock(&port->reporters_lock);
|
||||
}
|
||||
mutex_unlock(&devlink->lock);
|
||||
}
|
||||
out:
|
||||
mutex_unlock(&devlink_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user