From b08da83a5181a27897ccd2b82760ce3ac688503d Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Tue, 5 Dec 2017 17:13:33 +0900 Subject: [PATCH] hfi1_file_ioctl(): execute HFI1_IOCTL_TID_INVAL_READ locally --- kernel/file_ops.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/file_ops.c b/kernel/file_ops.c index 4be82f59..8f3acab0 100644 --- a/kernel/file_ops.c +++ b/kernel/file_ops.c @@ -526,9 +526,18 @@ long hfi1_file_ioctl(void *private_data, unsigned int cmd, case HFI1_IOCTL_TID_INVAL_READ: dkprintf("%s: HFI1_IOCTL_TID_INVAL_READ \n", __FUNCTION__); - /* This function is only invovled with the tid mmu caching. - * It is a no-op for us. */ - ret = 0; + if (copy_from_user(&tinfo, + (struct hfi11_tid_info __user *)arg, + sizeof(tinfo))) + return -EFAULT; + + ret = hfi1_user_exp_rcv_invalid(fd, &tinfo); + if (ret) + break; + addr = arg + offsetof(struct hfi1_tid_info, tidcnt); + if (copy_to_user((void __user *)addr, &tinfo.tidcnt, + sizeof(tinfo.tidcnt))) + ret = -EFAULT; break; case HFI1_IOCTL_RECV_CTRL: