[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180708065113.GJ3014@mtr-leonro.mtl.com>
Date: Sun, 8 Jul 2018 09:51:13 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Jann Horn <jannh@...gle.com>, Saeed Mahameed <saeedm@...lanox.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v2] net/mlx5: fix uaccess beyond "count" in debugfs
read/write handlers
On Fri, Jul 06, 2018 at 10:18:09PM +0200, Jann Horn wrote:
> In general, accessing userspace memory beyond the length of the supplied
> buffer in VFS read/write handlers can lead to both kernel memory corruption
> (via kernel_read()/kernel_write(), which can e.g. be triggered via
> sys_splice()) and privilege escalation inside userspace.
>
> In this case, the affected files are in debugfs (and should therefore only
> be accessible to root) and check that *pos is zero (which prevents the
> sys_splice() trick). Therefore, this is not a security fix, but rather a
> small cleanup.
>
> For the read handlers, fix it by using simple_read_from_buffer() instead of
> custom logic.
> For the write handler, add a check.
>
> changed in v2:
> - also fix dbg_write()
>
Thanks Jann,
Next time, please don't put changelog in commit message.
Saeed, are you taking it to mlx5-next? It is cleanup and better to be
sent to -next.
> Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
> Signed-off-by: Jann Horn <jannh@...gle.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 28 +++++--------------
> .../net/ethernet/mellanox/mlx5/core/debugfs.c | 22 ++-------------
> 2 files changed, 9 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
Thanks,
Reviewed-by: Leon Romanovsky <leonro@...lanox.com>
Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)
Powered by blists - more mailing lists