Skip to content

Commit 3191df0

Browse files
Cosmin Ratiukuba-moo
authored andcommitted
devlink rate: Remove unnecessary 'static' from a couple places
devlink_rate_node_get_by_name() and devlink_rate_nodes_destroy() have a couple of unnecessary static variables for iterating over devlink rates. This could lead to races/corruption/unhappiness if two concurrent operations execute the same function. Remove 'static' from both. It's amazing this was missed for 4+ years. While at it, I confirmed there are no more examples of this mistake in net/ with 1, 2 or 3 levels of indentation. Fixes: a8ecb93 ("devlink: Introduce rate nodes") Signed-off-by: Cosmin Ratiu <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7736aff commit 3191df0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/devlink/rate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ devlink_rate_leaf_get_from_info(struct devlink *devlink, struct genl_info *info)
3434
static struct devlink_rate *
3535
devlink_rate_node_get_by_name(struct devlink *devlink, const char *node_name)
3636
{
37-
static struct devlink_rate *devlink_rate;
37+
struct devlink_rate *devlink_rate;
3838

3939
list_for_each_entry(devlink_rate, &devlink->rate_list, list) {
4040
if (devlink_rate_is_node(devlink_rate) &&
@@ -819,8 +819,8 @@ EXPORT_SYMBOL_GPL(devl_rate_leaf_destroy);
819819
*/
820820
void devl_rate_nodes_destroy(struct devlink *devlink)
821821
{
822-
static struct devlink_rate *devlink_rate, *tmp;
823822
const struct devlink_ops *ops = devlink->ops;
823+
struct devlink_rate *devlink_rate, *tmp;
824824

825825
devl_assert_locked(devlink);
826826

0 commit comments

Comments
 (0)