Re: [PATCH rdma-rc] RDMA/mlx4: Map core_clock page to user space only when allowed
From: Jason Gunthorpe
Date: Thu Jun 03 2021 - 13:39:19 EST
On Thu, Jun 03, 2021 at 04:19:39PM +0300, Leon Romanovsky wrote:
> From: Shay Drory <shayd@xxxxxxxxxx>
>
> Currently when we map the hca_core_clock page to the user space,
> there are vulnerable registers, one of which is semaphore, on
> this page as well. If user read the wrong offset, it can modify the
> above semaphore and hang the device.
>
> Hence, mapping the hca_core_clock page to the user space only when
> user required it specifically.
>
> After this patch, mlx4 core_clock won't be mapped to user space by
> default. Oppose to current state, where mlx4 core_clock is always mapped
> to user space.
>
> Fixes: 52033cfb5aab ("IB/mlx4: Add mmap call to map the hardware clock")
> Signed-off-by: Shay Drory <shayd@xxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
> ---
> drivers/infiniband/hw/mlx4/main.c | 5 +----
> drivers/net/ethernet/mellanox/mlx4/fw.c | 3 +++
> drivers/net/ethernet/mellanox/mlx4/fw.h | 1 +
> drivers/net/ethernet/mellanox/mlx4/main.c | 6 ++++++
> include/linux/mlx4/device.h | 1 +
> 5 files changed, 12 insertions(+), 4 deletions(-)
Applied to for-rc, thanks
Jason