Selaa lähdekoodia

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>
Ira Weiny 9 vuotta sitten
vanhempi
commit
ca2f30a0a6
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  1. 3 0
      drivers/infiniband/hw/hfi1/file_ops.c

+ 3 - 0
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)))