diff options
author | Steen Hegelund <steen.hegelund@microchip.com> | 2022-11-17 22:31:13 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-11-21 12:33:02 +0100 |
commit | 71c9de995260222e739020104d477af4775a6d26 (patch) | |
tree | cab746f59a824580984ed4c4e3f231a554edaedc /drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c | |
parent | net: microchip: sparx5: Add VCAP debugFS key/action support for the VCAP API (diff) | |
download | linux-71c9de995260222e739020104d477af4775a6d26.tar.xz linux-71c9de995260222e739020104d477af4775a6d26.zip |
net: microchip: sparx5: Add VCAP locking to protect rules
This ensures that the VCAP cache and the lists maintained in the VCAP
instance is protected when accessed by different clients.
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c')
-rw-r--r-- | drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c b/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c index e70ff1aa6d57..0c4d4e6d51e6 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c @@ -579,6 +579,7 @@ static void sparx5_vcap_admin_free(struct vcap_admin *admin) { if (!admin) return; + mutex_destroy(&admin->lock); kfree(admin->cache.keystream); kfree(admin->cache.maskstream); kfree(admin->cache.actionstream); @@ -598,6 +599,7 @@ sparx5_vcap_admin_alloc(struct sparx5 *sparx5, struct vcap_control *ctrl, INIT_LIST_HEAD(&admin->list); INIT_LIST_HEAD(&admin->rules); INIT_LIST_HEAD(&admin->enabled); + mutex_init(&admin->lock); admin->vtype = cfg->vtype; admin->vinst = cfg->vinst; admin->lookups = cfg->lookups; |