Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e9ef246 authored by Ira Weiny's avatar Ira Weiny Committed by Doug Ledford
Browse files

IB/qib: Prevent context loss



If a context has already been assigned to an FD, prevent
another assignment.

Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent ca2f30a0
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -2178,6 +2178,11 @@ static ssize_t qib_write(struct file *fp, const char __user *data,


	switch (cmd.type) {
	switch (cmd.type) {
	case QIB_CMD_ASSIGN_CTXT:
	case QIB_CMD_ASSIGN_CTXT:
		if (rcd) {
			ret = -EINVAL;
			goto bail;
		}

		ret = qib_assign_ctxt(fp, &cmd.cmd.user_info);
		ret = qib_assign_ctxt(fp, &cmd.cmd.user_info);
		if (ret)
		if (ret)
			goto bail;
			goto bail;