diff options
author | Dmytro Linkin <dlinkin@nvidia.com> | 2021-06-23 16:43:13 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-23 15:46:25 -0700 |
commit | 1321ed5e76488cfd7a5d3ee83254be9b7c1cc581 (patch) | |
tree | 2d54a64ea556d08b41b9851eb29abe2e61a5b544 /net/core | |
parent | a2f7dc00ea51a9dbb7c5b4ca8e508acb24f7ca8c (diff) |
devlink: Decrease refcnt of parent rate object on leaf destroy
Port functions, like SFs, can be deleted by the user when its leaf rate
object has parent node. In such case node refcnt won't be decreased
which blocks the node from deletion later.
Do simple refcnt decrease, since driver in cleanup stage. This:
1) assumes that driver took proper internal parent unset action;
2) allows to avoid nested callbacks call and deadlock.
Fixes: d75559845078 ("devlink: Allow setting parent node of rate objects")
Signed-off-by: Dmytro Linkin <dlinkin@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/devlink.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c index 566ddd147633..ba27395d8fb3 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -9275,6 +9275,8 @@ void devlink_rate_leaf_destroy(struct devlink_port *devlink_port) mutex_lock(&devlink->lock); devlink_rate_notify(devlink_rate, DEVLINK_CMD_RATE_DEL); + if (devlink_rate->parent) + refcount_dec(&devlink_rate->parent->refcnt); list_del(&devlink_rate->list); devlink_port->devlink_rate = NULL; mutex_unlock(&devlink->lock); |