diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-08-22 11:27:32 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@primarydata.com> | 2014-09-09 16:01:36 -0400 |
commit | e0b93eddfe17dcb7d644eb5d6ad02a86fc41a977 (patch) | |
tree | 97ceab83fdbfd3bf54fd8235a66da665fbcc83a7 /fs/fcntl.c | |
parent | 1c994a0909a556508c2cc26ab5d9e13c5ce33aa0 (diff) |
security: make security_file_set_fowner, f_setown and __f_setown void return
security_file_set_fowner always returns 0, so make it f_setown and
__f_setown void return functions and fix up the error handling in the
callers.
Cc: linux-security-module@vger.kernel.org
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/fcntl.c')
-rw-r--r-- | fs/fcntl.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c index 22d1c3df61ac..99d440a4a6ba 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -98,26 +98,19 @@ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, | |||
98 | write_unlock_irq(&filp->f_owner.lock); | 98 | write_unlock_irq(&filp->f_owner.lock); |
99 | } | 99 | } |
100 | 100 | ||
101 | int __f_setown(struct file *filp, struct pid *pid, enum pid_type type, | 101 | void __f_setown(struct file *filp, struct pid *pid, enum pid_type type, |
102 | int force) | 102 | int force) |
103 | { | 103 | { |
104 | int err; | 104 | security_file_set_fowner(filp); |
105 | |||
106 | err = security_file_set_fowner(filp); | ||
107 | if (err) | ||
108 | return err; | ||
109 | |||
110 | f_modown(filp, pid, type, force); | 105 | f_modown(filp, pid, type, force); |
111 | return 0; | ||
112 | } | 106 | } |
113 | EXPORT_SYMBOL(__f_setown); | 107 | EXPORT_SYMBOL(__f_setown); |
114 | 108 | ||
115 | int f_setown(struct file *filp, unsigned long arg, int force) | 109 | void f_setown(struct file *filp, unsigned long arg, int force) |
116 | { | 110 | { |
117 | enum pid_type type; | 111 | enum pid_type type; |
118 | struct pid *pid; | 112 | struct pid *pid; |
119 | int who = arg; | 113 | int who = arg; |
120 | int result; | ||
121 | type = PIDTYPE_PID; | 114 | type = PIDTYPE_PID; |
122 | if (who < 0) { | 115 | if (who < 0) { |
123 | type = PIDTYPE_PGID; | 116 | type = PIDTYPE_PGID; |
@@ -125,9 +118,8 @@ int f_setown(struct file *filp, unsigned long arg, int force) | |||
125 | } | 118 | } |
126 | rcu_read_lock(); | 119 | rcu_read_lock(); |
127 | pid = find_vpid(who); | 120 | pid = find_vpid(who); |
128 | result = __f_setown(filp, pid, type, force); | 121 | __f_setown(filp, pid, type, force); |
129 | rcu_read_unlock(); | 122 | rcu_read_unlock(); |
130 | return result; | ||
131 | } | 123 | } |
132 | EXPORT_SYMBOL(f_setown); | 124 | EXPORT_SYMBOL(f_setown); |
133 | 125 | ||
@@ -181,7 +173,7 @@ static int f_setown_ex(struct file *filp, unsigned long arg) | |||
181 | if (owner.pid && !pid) | 173 | if (owner.pid && !pid) |
182 | ret = -ESRCH; | 174 | ret = -ESRCH; |
183 | else | 175 | else |
184 | ret = __f_setown(filp, pid, type, 1); | 176 | __f_setown(filp, pid, type, 1); |
185 | rcu_read_unlock(); | 177 | rcu_read_unlock(); |
186 | 178 | ||
187 | return ret; | 179 | return ret; |
@@ -302,7 +294,8 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, | |||
302 | force_successful_syscall_return(); | 294 | force_successful_syscall_return(); |
303 | break; | 295 | break; |
304 | case F_SETOWN: | 296 | case F_SETOWN: |
305 | err = f_setown(filp, arg, 1); | 297 | f_setown(filp, arg, 1); |
298 | err = 0; | ||
306 | break; | 299 | break; |
307 | case F_GETOWN_EX: | 300 | case F_GETOWN_EX: |
308 | err = f_getown_ex(filp, arg); | 301 | err = f_getown_ex(filp, arg); |