lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170725192054.538706080@linuxfoundation.org>
Date:   Tue, 25 Jul 2017 12:22:51 -0700
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org,
        Bart Van Assche <bart.vanassche@...disk.com>,
        Max Gurtovoy <maxg@...lanox.com>,
        Sagi Grimberg <sagi@...mberg.me>,
        Leon Romanovsky <leonro@...lanox.com>,
        Israel Rukshin <israelr@...lanox.com>,
        Doug Ledford <dledford@...hat.com>
Subject: [PATCH 4.12 172/196] mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array

4.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <bart.vanassche@...disk.com>

commit 99975cd4fda52974a767aa44fe0b1a8f74950d9d upstream.

ib_map_mr_sg() can pass an SG-list to .map_mr_sg() that is larger
than what fits into a single MR. .map_mr_sg() must not attempt to
map more SG-list elements than what fits into a single MR.
Hence make sure that mlx5_ib_sg_to_klms() does not write outside
the MR klms[] array.

Fixes: b005d3164713 ("mlx5: Add arbitrary sg list support")
Signed-off-by: Bart Van Assche <bart.vanassche@...disk.com>
Reviewed-by: Max Gurtovoy <maxg@...lanox.com>
Cc: Sagi Grimberg <sagi@...mberg.me>
Cc: Leon Romanovsky <leonro@...lanox.com>
Cc: Israel Rukshin <israelr@...lanox.com>
Acked-by: Leon Romanovsky <leonro@...lanox.com>
Reviewed-by: Sagi Grimberg <sagi@...mberg.me>
Signed-off-by: Doug Ledford <dledford@...hat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

---
 drivers/infiniband/hw/mlx5/mr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1779,7 +1779,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr
 	mr->ndescs = sg_nents;
 
 	for_each_sg(sgl, sg, sg_nents, i) {
-		if (unlikely(i > mr->max_descs))
+		if (unlikely(i >= mr->max_descs))
 			break;
 		klms[i].va = cpu_to_be64(sg_dma_address(sg) + sg_offset);
 		klms[i].bcount = cpu_to_be32(sg_dma_len(sg) - sg_offset);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ