diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2016-05-31 03:33:57 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-16 09:30:48 +0200 |
commit | 694dfd0ef02ded5b6fbea03a12350ee8a74921d5 (patch) | |
tree | ad110ff54b61ed72216cbe5f89dd7b5873736d24 | |
parent | 9c946c931b63068c4197d9d0b4d24635418bc67d (diff) |
ipath: Restrict use of the write() interface
Commit e6bd18f57aad ("IB/security: Restrict use of the write()
interface") fixed a security problem with various write()
implementations in the Infiniband subsystem. In older kernel versions
the ipath_write() function has the same problem and needs the same
restriction. (The ipath driver has been completely removed upstream.)
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/rdma/ipath/ipath_file_ops.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/staging/rdma/ipath/ipath_file_ops.c b/drivers/staging/rdma/ipath/ipath_file_ops.c index 13c3cd11ab92..05d30f433b19 100644 --- a/drivers/staging/rdma/ipath/ipath_file_ops.c +++ b/drivers/staging/rdma/ipath/ipath_file_ops.c @@ -45,6 +45,8 @@ #include <linux/uio.h> #include <asm/pgtable.h> +#include <rdma/ib.h> + #include "ipath_kernel.h" #include "ipath_common.h" #include "ipath_user_sdma.h" @@ -2243,6 +2245,9 @@ static ssize_t ipath_write(struct file *fp, const char __user *data, ssize_t ret = 0; void *dest; + if (WARN_ON_ONCE(!ib_safe_file_access(fp))) + return -EACCES; + if (count < sizeof(cmd.type)) { ret = -EINVAL; goto bail; |