aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_ruc.c
diff options
context:
space:
mode:
authorRalph Campbell <ralph.campbell@qlogic.com>2007-06-18 17:24:44 -0400
committerRoland Dreier <rolandd@cisco.com>2007-07-09 23:12:26 -0400
commit30d149ab58cc3ed8e4bc9c4dc45bebbed0e84b6e (patch)
treef85f47458efb9e98f01b490a539dbf873bbaddd9 /drivers/infiniband/hw/ipath/ipath_ruc.c
parentdb5518cd09c21f0fa70af0a4ca38badd90622c9e (diff)
IB/ipath: Fix possible data corruption if multiple SGEs used for receive
The code to copy data from the receive queue buffers to the IB SGEs doesn't check the SGE length, only the memory region/page length when copying data. This could overwrite parts of the user's memory that were not intended to be written. It can only happen if multiple SGEs are used to describe a receive buffer which almost never happens in practice. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_ruc.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c
index 837118676cc7..1b0e62b761bb 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -396,6 +396,8 @@ again:
396 396
397 if (len > sge->length) 397 if (len > sge->length)
398 len = sge->length; 398 len = sge->length;
399 if (len > sge->sge_length)
400 len = sge->sge_length;
399 BUG_ON(len == 0); 401 BUG_ON(len == 0);
400 ipath_copy_sge(&qp->r_sge, sge->vaddr, len); 402 ipath_copy_sge(&qp->r_sge, sge->vaddr, len);
401 sge->vaddr += len; 403 sge->vaddr += len;