lkml.org 
[lkml]   [2017]   [Jan]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2 linux-next] ext4: check inode permissions in ext4_ioctl()
Date
According to other FS like UDF, ioctl has to check if inode
is readable before proceeding otherwise permissions updated between
file opening and ioctl are ignored.

Set operations were already protected but nothing around
get like EXT4_IOC_GETVERSION

This patch applies the same test than udf_ioctl() but returns
-EACCES "permission denied" like the rest of ext4_ioctl()

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/ext4/ioctl.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 49fd137..4f113e6 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -449,6 +449,9 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
struct ext4_inode_info *ei = EXT4_I(inode);
unsigned int flags;

+ if (inode_permission(inode, MAY_READ) != 0)
+ return -EACCES;
+
ext4_debug("cmd = %u, arg = %lu\n", cmd, arg);

switch (cmd) {
--
2.7.4
\
 
 \ /
  Last update: 2017-01-01 11:17    [W:0.051 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site