stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array" has been added to the 4.9-stable tree
@ 2017-07-25  4:30 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-07-25  4:30 UTC (permalink / raw)
  To: bart.vanassche, dledford, gregkh, israelr, leonro, maxg, sagi
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mlx5-avoid-that-mlx5_ib_sg_to_klms-overflows-the-klms-array.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 99975cd4fda52974a767aa44fe0b1a8f74950d9d Mon Sep 17 00:00:00 2001
From: Bart Van Assche <bart.vanassche@sandisk.com>
Date: Mon, 24 Apr 2017 15:15:28 -0700
Subject: mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array

From: Bart Van Assche <bart.vanassche@sandisk.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@sandisk.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Leon Romanovsky <leonro@mellanox.com>
Cc: Israel Rukshin <israelr@mellanox.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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
@@ -1823,7 +1823,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);


Patches currently in stable-queue which might be from bart.vanassche@sandisk.com are

queue-4.9/mlx5-avoid-that-mlx5_ib_sg_to_klms-overflows-the-klms-array.patch
queue-4.9/xen-scsiback-fix-a-tmr-related-use-after-free.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-07-25  4:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-25  4:30 Patch "mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array" has been added to the 4.9-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).