Skip to contentSkip to conversation

ipath: Restrict use of the write() interface

PATCH Applied Ben Hutchings 2 participants 2 messages May 31, 2016 – Aug 14, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.)

---

drivers/staging/rdma/ipath/ipath_file_ops.c +5 -0
@@ -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 *
 	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;
maintainer Applied
#1 lore raw

Patch "ipath: Restrict use of the write() interface" has been added to the 4.4-stable tree

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

ipath: Restrict use of the write() interface

to the 4.4-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:
ipath-restrict-use-of-the-write-interface.patch
and it can be found in the queue-4.4 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 [email protected] Sun Aug 14 16:54:26 2016

From: Ben Hutchings <[email protected]>
Date: Tue, 31 May 2016 03:33:57 +0100
Subject: ipath: Restrict use of the write() interface
To: [email protected]
Cc: Jason Gunthorpe <[email protected]>, Doug Ledford <[email protected]>, [email protected]
Message-ID: <[email protected]>
Content-Disposition: inline

From: Ben Hutchings <[email protected]>

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.)

---
 drivers/staging/rdma/ipath/ipath_file_ops.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/staging/rdma/ipath/ipath_file_ops.c +5 -0
@@ -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 *
 	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;

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

queue-4.4/ipath-restrict-use-of-the-write-interface.patch