Skip to contentSkip to conversation

Patch "IB/mlx5: Fix kernel to user leak prevention logic" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jun 18, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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

IB/mlx5: Fix kernel to user leak prevention logic

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:
ib-mlx5-fix-kernel-to-user-leak-prevention-logic.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 <[email protected]> know about it.

Quoted 1 line

From de8d6e02efbdb259c67832ccf027d7ace9b91d5d Mon Sep 17 00:00:00 2001

From: Eli Cohen <[email protected]>
Date: Tue, 3 Jan 2017 23:55:19 +0200
Subject: IB/mlx5: Fix kernel to user leak prevention logic

From: Eli Cohen <[email protected]>

commit de8d6e02efbdb259c67832ccf027d7ace9b91d5d upstream.

The logic was broken as it failed to update the response length for architectures with PAGE_SIZE larger than 4kB. As a result further extension of the ucontext response struct would fail.

Fixes d69e3bcf7976 ('IB/mlx5: Mmap the HCA's core clock register to user-space')
---
 drivers/infiniband/hw/mlx5/main.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/infiniband/hw/mlx5/main.c +7 -7
@@ -1105,13 +1105,13 @@ static struct ib_ucontext *mlx5_ib_alloc
 	 * pretend we don't support reading the HCA's core clock. This is also
 	 * forced by mmap function.
 	 */
-	if (PAGE_SIZE <= 4096 &&
-	    field_avail(typeof(resp), hca_core_clock_offset, udata->outlen)) {
-		resp.comp_mask |=
-			MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET;
-		resp.hca_core_clock_offset =
-			offsetof(struct mlx5_init_seg, internal_timer_h) %
-			PAGE_SIZE;
+	if (field_avail(typeof(resp), hca_core_clock_offset, udata->outlen)) {
+		if (PAGE_SIZE <= 4096) {
+			resp.comp_mask |=
+				MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET;
+			resp.hca_core_clock_offset =
+				offsetof(struct mlx5_init_seg, internal_timer_h) % PAGE_SIZE;
+		}
 		resp.response_length += sizeof(resp.hca_core_clock_offset) +
 					sizeof(resp.reserved2);
 	}

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/ib-mlx5-fix-kernel-to-user-leak-prevention-logic.patch