From: Ira Weiny Date: Thu, 9 Jun 2016 14:51:39 +0000 (-0700) Subject: IB/qib: Prevent context loss X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5e9ef24619486213223053678eb9175630ef6bf9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git IB/qib: Prevent context loss If a context has already been assigned to an FD, prevent another assignment. Reviewed-by: Dennis Dalessandro Signed-off-by: Ira Weiny Signed-off-by: Doug Ledford --- 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;