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

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
...@@ -203,6 +203,9 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd, ...@@ -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)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment