nvvse: Allowing multiple access to dev node

- This CL partially reverts the changes done in CL - 2891721
- Current implementation checks if multiple process/threads/apps
  try to access same dev node when it is already open by another
  process/thread/app, and throws an error if condition is true causing
  new process/threads/apps to fail as in bug mentioned below
- This change allows multiple process/threads/apps to access the same
  dev node.

bug 4126726
jira ESSS-759

Change-Id: Ibe18449014e69148ae2feebd854b6c5d278f5bc4
Signed-off-by: Advaya Andhare <aandhare@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2946094
(cherry picked from commit 615a1aba49e2662d767a23e47fed329627f6f91e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2956815
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nagaraj P N <nagarajp@nvidia.com>
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Advaya Andhare
2023-08-01 12:05:01 +00:00
committed by mobile promotions
parent 0f7f6190a1
commit 7d1a687636

View File

@@ -71,7 +71,6 @@
struct nvvse_devnode { struct nvvse_devnode {
struct miscdevice *g_misc_devices; struct miscdevice *g_misc_devices;
bool is_node_open;
bool sha_init_done; bool sha_init_done;
} nvvse_devnode[MAX_NUMBER_MISC_DEVICES]; } nvvse_devnode[MAX_NUMBER_MISC_DEVICES];
@@ -1815,11 +1814,6 @@ static int tnvvse_crypto_dev_open(struct inode *inode, struct file *filp)
return -EINVAL; return -EINVAL;
} }
if (nvvse_devnode[node_id].is_node_open) {
pr_err("%s: Trying to open already opened node. node_id %u\n", __func__, node_id);
return -EAGAIN;
}
ctx = kzalloc(sizeof(struct tnvvse_crypto_ctx), GFP_KERNEL); ctx = kzalloc(sizeof(struct tnvvse_crypto_ctx), GFP_KERNEL);
if (!ctx) { if (!ctx) {
return -ENOMEM; return -ENOMEM;
@@ -1843,7 +1837,6 @@ static int tnvvse_crypto_dev_open(struct inode *inode, struct file *filp)
} }
filp->private_data = ctx; filp->private_data = ctx;
nvvse_devnode[node_id].is_node_open = true;
return ret; return ret;
@@ -1863,7 +1856,6 @@ static int tnvvse_crypto_dev_release(struct inode *inode, struct file *filp)
mutex_destroy(&ctx->lock); mutex_destroy(&ctx->lock);
kfree(ctx->sha_result); kfree(ctx->sha_result);
kfree(ctx->rng_buff); kfree(ctx->rng_buff);
nvvse_devnode[ctx->node_id].is_node_open = false;
kfree(ctx); kfree(ctx);
filp->private_data = NULL; filp->private_data = NULL;