aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/hfi1/user_exp_rcv.c
diff options
context:
space:
mode:
authorMichael J. Ruhl <michael.j.ruhl@intel.com>2017-04-09 10:16:03 -0700
committerDoug Ledford <dledford@redhat.com>2017-04-28 13:48:01 -0400
commitdb730894f4f7e7afcaf31d17679ed58b4f781500 (patch)
tree32e6004b5a0265a0f19668370f160016959721c4 /drivers/infiniband/hw/hfi1/user_exp_rcv.c
parentIB/rdmavt/hfi1/qib: Use the MGID and MLID for multicast addressing (diff)
downloadlinux-dev-db730894f4f7e7afcaf31d17679ed58b4f781500.tar.xz
linux-dev-db730894f4f7e7afcaf31d17679ed58b4f781500.zip
IB/hfi1: Validate the TID count before using it
Improve the safety of the code by validating the user supplied tidcnt before use. Reviewed-by: Mitko Haralanov <mitko.haralanov@intel.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/user_exp_rcv.c')
-rw-r--r--drivers/infiniband/hw/hfi1/user_exp_rcv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.c b/drivers/infiniband/hw/hfi1/user_exp_rcv.c
index 002214eef472..35c6e7ec8ad6 100644
--- a/drivers/infiniband/hw/hfi1/user_exp_rcv.c
+++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.c
@@ -579,6 +579,9 @@ int hfi1_user_exp_rcv_clear(struct file *fp, struct hfi1_tid_info *tinfo)
u32 *tidinfo;
unsigned tididx;
+ if (unlikely(tinfo->tidcnt > fd->tid_used))
+ return -EINVAL;
+
tidinfo = memdup_user((void __user *)(unsigned long)tinfo->tidlist,
sizeof(tidinfo[0]) * tinfo->tidcnt);
if (IS_ERR(tidinfo))