mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: add adequate checks for control-fifo node.
Add additional checks to prevent users without both READ/WRITE permissions from opening the control-fifo device node. Jira NVGPU-8619 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Change-Id: Ie0be0f578c154b45547d5d150ddabaa5936bda80 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2813816 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Prateek Sethi <prsethi@nvidia.com> Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com> Tested-by: Prateek Sethi <prsethi@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
48ef56104d
commit
e583e4a6dc
@@ -612,10 +612,16 @@ int nvgpu_nvs_ctrl_fifo_ops_open(struct inode *inode, struct file *filp)
|
||||
int err = 0;
|
||||
struct nvgpu_nvs_domain_ctrl_fifo_user_linux *linux_user;
|
||||
bool writable = filp->f_mode & FMODE_WRITE;
|
||||
bool readable = filp->f_mode & FMODE_READ;
|
||||
|
||||
cdev = container_of(inode->i_cdev, struct nvgpu_cdev, cdev);
|
||||
g = nvgpu_get_gk20a_from_cdev(cdev);
|
||||
|
||||
if (!writable && !readable) {
|
||||
nvgpu_err(g, "User doesn't have adequate permission to open this device");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
err = gk20a_busy(g);
|
||||
if (err != 0) {
|
||||
nvgpu_err(g, "Unable to power on the device");
|
||||
|
||||
Reference in New Issue
Block a user