diff options
author | Ira Weiny <ira.weiny@intel.com> | 2016-06-09 17:51:33 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-06-18 03:11:26 +0300 |
commit | ca2f30a0a6786e6b08eeb8abb2bbb8df58709d6e (patch) | |
tree | 4af5054eb77863e1488578ca2c4a966da69292d0 /drivers/infiniband/hw | |
parent | c3c64a951cbdb6096d02dcc339a9c807ce1e976a (diff) | |
download | linux-ca2f30a0a6786e6b08eeb8abb2bbb8df58709d6e.tar.xz |
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/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/hfi1/file_ops.c | 3 |
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))) |