Skip to contentSkip to conversation

security: call security_file_permission from rw_verify_area

RFC PATCH New James Morris 1 participant 1 message Jan 12, 2008 VFS

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 security: call security_file_permission from rw_verify_area

Please review.

Tested with SELinux in enforcing mode.

---

All instances of rw_verify_area() are followed by a call to security_file_permission(), so just call the latter from the former.

---
 fs/compat.c     |    4 ---
 fs/read_write.c |   63 +++++++++++++++++++++----------------------------------
 fs/splice.c     |    8 -------
 3 files changed, 24 insertions(+), 51 deletions(-)
fs/compat.c +0 -4
index 15078ce..5216c3f 100644
@@ -1104,10 +1104,6 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
 	if (ret < 0)
 		goto out;
 
-	ret = security_file_permission(file, type == READ ? MAY_READ:MAY_WRITE);
-	if (ret)
-		goto out;
-
 	fnv = NULL;
 	if (type == READ) {
 		fn = file->f_op->read;
fs/read_write.c +24 -39

114 lines not on this page · raw message

fs/splice.c +0 -8
index 6bdcb61..56b802b 100644
@@ -908,10 +908,6 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
 	if (unlikely(ret < 0))
 		return ret;
 
-	ret = security_file_permission(out, MAY_WRITE);
-	if (unlikely(ret < 0))
-		return ret;
-
 	return out->f_op->splice_write(pipe, out, ppos, len, flags);
 }
 
@@ -934,10 +930,6 @@ static long do_splice_to(struct file *in, loff_t *ppos,
 	if (unlikely(ret < 0))
 		return ret;
 
-	ret = security_file_permission(in, MAY_READ);
-	if (unlikely(ret < 0))
-		return ret;
-
 	return in->f_op->splice_read(in, ppos, pipe, len, flags);
 }
 
Signature · 1 line
1.5.3.7