aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rdma/hfi1/file_ops.c
diff options
context:
space:
mode:
authorIra Weiny <ira.weiny@intel.com>2015-09-17 13:47:49 -0400
committerDoug Ledford <dledford@redhat.com>2015-09-18 11:28:47 -0400
commite116a64fab650aed3d7b9b4db0b59c07f361bc9f (patch)
tree87443bf22b75104c7a707e538c3ec4f5565d1a6f /drivers/staging/rdma/hfi1/file_ops.c
parentIB/hfi1: mask vs shift confusion (diff)
downloadlinux-dev-e116a64fab650aed3d7b9b4db0b59c07f361bc9f.tar.xz
linux-dev-e116a64fab650aed3d7b9b4db0b59c07f361bc9f.zip
IB/hfi: Properly set permissions for user device files
Some of the device files are required to be user accessible for PSM while most should remain accessible only by root. Add a parameter to hfi1_cdev_init which controls if the user should have access to this device which places it in a different class with the appropriate devnode callback. In addition set the devnode call back for the existing class to be a bit more explicit for those permissions. Finally remove the unnecessary null check before class_destroy Tested-by: Donald Dutile <ddutile@redhat.com> Signed-off-by: Haralanov, Mitko (mitko.haralanov@intel.com) Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/staging/rdma/hfi1/file_ops.c')
-rw-r--r--drivers/staging/rdma/hfi1/file_ops.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c
index 2c43ca5a379b..72d38500d8ce 100644
--- a/drivers/staging/rdma/hfi1/file_ops.c
+++ b/drivers/staging/rdma/hfi1/file_ops.c
@@ -2090,14 +2090,16 @@ static int user_add(struct hfi1_devdata *dd)
if (atomic_inc_return(&user_count) == 1) {
ret = hfi1_cdev_init(0, class_name(), &hfi1_file_ops,
- &wildcard_cdev, &wildcard_device);
+ &wildcard_cdev, &wildcard_device,
+ true);
if (ret)
goto done;
}
snprintf(name, sizeof(name), "%s_%d", class_name(), dd->unit);
ret = hfi1_cdev_init(dd->unit + 1, name, &hfi1_file_ops,
- &dd->user_cdev, &dd->user_device);
+ &dd->user_cdev, &dd->user_device,
+ true);
if (ret)
goto done;
@@ -2105,7 +2107,8 @@ static int user_add(struct hfi1_devdata *dd)
snprintf(name, sizeof(name),
"%s_ui%d", class_name(), dd->unit);
ret = hfi1_cdev_init(dd->unit + UI_OFFSET, name, &ui_file_ops,
- &dd->ui_cdev, &dd->ui_device);
+ &dd->ui_cdev, &dd->ui_device,
+ false);
if (ret)
goto done;
}