diff options
author | Jann Horn <jannh@google.com> | 2018-07-06 23:48:03 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-09 22:15:12 +0300 |
commit | 60e6627f12a78203a093ca05b7bca15627747d81 (patch) | |
tree | 76dcde09c85d2f3e1ec739140172713546b2d115 /net/rxrpc | |
parent | 222c7b1fd4dcc596e4a21dc93f49d9c976f7e314 (diff) | |
download | linux-60e6627f12a78203a093ca05b7bca15627747d81.tar.xz |
IB/mlx5: fix uaccess beyond "count" in debugfs read/write handlers
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 the read handlers check that *pos is zero
(meaning that at least sys_splice() can't trigger kernel memory
corruption). Because of the root requirement, this is not a security fix,
but rather a cleanup.
For the read handlers, fix it by using simple_read_from_buffer() instead
of custom logic. Add min() calls to the write handlers.
Fixes: 4a2da0b8c078 ("IB/mlx5: Add debug control parameters for congestion control")
Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: Jann Horn <jannh@google.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'net/rxrpc')
0 files changed, 0 insertions, 0 deletions