diff options
author | Ira Weiny <ira.weiny@intel.com> | 2016-06-09 07:51:39 -0700 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-06-17 20:11:26 -0400 |
commit | 5e9ef24619486213223053678eb9175630ef6bf9 (patch) | |
tree | 1a2b29c2d88c114c46437568bd3aea9763e35202 /drivers/infiniband/hw/qib/qib_file_ops.c | |
parent | ca2f30a0a6786e6b08eeb8abb2bbb8df58709d6e (diff) | |
download | talos-obmc-linux-5e9ef24619486213223053678eb9175630ef6bf9.tar.gz talos-obmc-linux-5e9ef24619486213223053678eb9175630ef6bf9.zip |
IB/qib: 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/qib/qib_file_ops.c')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_file_ops.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c index ff946d5f59e4..382466a90da7 100644 --- a/drivers/infiniband/hw/qib/qib_file_ops.c +++ b/drivers/infiniband/hw/qib/qib_file_ops.c @@ -2178,6 +2178,11 @@ static ssize_t qib_write(struct file *fp, const char __user *data, switch (cmd.type) { case QIB_CMD_ASSIGN_CTXT: + if (rcd) { + ret = -EINVAL; + goto bail; + } + ret = qib_assign_ctxt(fp, &cmd.cmd.user_info); if (ret) goto bail; |