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

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

IB/hfi1: 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 c3c64a95
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -203,6 +203,9 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,


	switch (cmd) {
	switch (cmd) {
	case HFI1_IOCTL_ASSIGN_CTXT:
	case HFI1_IOCTL_ASSIGN_CTXT:
		if (uctxt)
			return -EINVAL;

		if (copy_from_user(&uinfo,
		if (copy_from_user(&uinfo,
				   (struct hfi1_user_info __user *)arg,
				   (struct hfi1_user_info __user *)arg,
				   sizeof(uinfo)))
				   sizeof(uinfo)))