summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIra Weiny <ira.weiny@intel.com>2016-06-09 16:51:33 +0200
committerDoug Ledford <dledford@redhat.com>2016-06-18 02:11:26 +0200
commitca2f30a0a6786e6b08eeb8abb2bbb8df58709d6e (patch)
tree4af5054eb77863e1488578ca2c4a966da69292d0 /drivers
parentIB/hfi1: Increase packet egress timeout (diff)
downloadlinux-ca2f30a0a6786e6b08eeb8abb2bbb8df58709d6e.tar.xz
linux-ca2f30a0a6786e6b08eeb8abb2bbb8df58709d6e.zip
IB/hfi1: Prevent context loss
If a context has already been assigned to an FD, prevent another assignment. Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/hfi1/file_ops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c
index 7a5b0e676cc7..c702a009608f 100644
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@ -203,6 +203,9 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,
switch (cmd) {
case HFI1_IOCTL_ASSIGN_CTXT:
+ if (uctxt)
+ return -EINVAL;
+
if (copy_from_user(&uinfo,
(struct hfi1_user_info __user *)arg,
sizeof(uinfo)))