summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/ipath/ipath_ud.c
diff options
context:
space:
mode:
authorRalph Campbell <ralph.campbell@qlogic.com>2007-06-19 01:24:44 +0400
committerRoland Dreier <rolandd@cisco.com>2007-07-10 07:12:26 +0400
commit30d149ab58cc3ed8e4bc9c4dc45bebbed0e84b6e (patch)
treef85f47458efb9e98f01b490a539dbf873bbaddd9 /drivers/infiniband/hw/ipath/ipath_ud.c
parentdb5518cd09c21f0fa70af0a4ca38badd90622c9e (diff)
downloadlinux-30d149ab58cc3ed8e4bc9c4dc45bebbed0e84b6e.tar.xz
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_ud.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index a518f7c8fa83..0b5a6ac1bb83 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -231,6 +231,8 @@ static void ipath_ud_loopback(struct ipath_qp *sqp,
if (len > length)
len = length;
+ if (len > sge->sge_length)
+ len = sge->sge_length;
BUG_ON(len == 0);
ipath_copy_sge(&rsge, sge->vaddr, len);
sge->vaddr += len;