diff options
Diffstat (limited to 'fs/compat.c')
-rw-r--r-- | fs/compat.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/fs/compat.c b/fs/compat.c index ed43e17a5dc6..c9d1472e65c5 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -197,8 +197,8 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs * | |||
197 | { | 197 | { |
198 | 198 | ||
199 | if (sizeof ubuf->f_blocks == 4) { | 199 | if (sizeof ubuf->f_blocks == 4) { |
200 | if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail) & | 200 | if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail | |
201 | 0xffffffff00000000ULL) | 201 | kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL) |
202 | return -EOVERFLOW; | 202 | return -EOVERFLOW; |
203 | /* f_files and f_ffree may be -1; it's okay | 203 | /* f_files and f_ffree may be -1; it's okay |
204 | * to stuff that into 32 bits */ | 204 | * to stuff that into 32 bits */ |
@@ -234,18 +234,18 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs * | |||
234 | * The following statfs calls are copies of code from fs/open.c and | 234 | * The following statfs calls are copies of code from fs/open.c and |
235 | * should be checked against those from time to time | 235 | * should be checked against those from time to time |
236 | */ | 236 | */ |
237 | asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs __user *buf) | 237 | asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) |
238 | { | 238 | { |
239 | struct nameidata nd; | 239 | struct path path; |
240 | int error; | 240 | int error; |
241 | 241 | ||
242 | error = user_path_walk(path, &nd); | 242 | error = user_path(pathname, &path); |
243 | if (!error) { | 243 | if (!error) { |
244 | struct kstatfs tmp; | 244 | struct kstatfs tmp; |
245 | error = vfs_statfs(nd.path.dentry, &tmp); | 245 | error = vfs_statfs(path.dentry, &tmp); |
246 | if (!error) | 246 | if (!error) |
247 | error = put_compat_statfs(buf, &tmp); | 247 | error = put_compat_statfs(buf, &tmp); |
248 | path_put(&nd.path); | 248 | path_put(&path); |
249 | } | 249 | } |
250 | return error; | 250 | return error; |
251 | } | 251 | } |
@@ -271,8 +271,8 @@ out: | |||
271 | static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstatfs *kbuf) | 271 | static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstatfs *kbuf) |
272 | { | 272 | { |
273 | if (sizeof ubuf->f_blocks == 4) { | 273 | if (sizeof ubuf->f_blocks == 4) { |
274 | if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail) & | 274 | if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail | |
275 | 0xffffffff00000000ULL) | 275 | kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL) |
276 | return -EOVERFLOW; | 276 | return -EOVERFLOW; |
277 | /* f_files and f_ffree may be -1; it's okay | 277 | /* f_files and f_ffree may be -1; it's okay |
278 | * to stuff that into 32 bits */ | 278 | * to stuff that into 32 bits */ |
@@ -299,21 +299,21 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat | |||
299 | return 0; | 299 | return 0; |
300 | } | 300 | } |
301 | 301 | ||
302 | asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, struct compat_statfs64 __user *buf) | 302 | asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t sz, struct compat_statfs64 __user *buf) |
303 | { | 303 | { |
304 | struct nameidata nd; | 304 | struct path path; |
305 | int error; | 305 | int error; |
306 | 306 | ||
307 | if (sz != sizeof(*buf)) | 307 | if (sz != sizeof(*buf)) |
308 | return -EINVAL; | 308 | return -EINVAL; |
309 | 309 | ||
310 | error = user_path_walk(path, &nd); | 310 | error = user_path(pathname, &path); |
311 | if (!error) { | 311 | if (!error) { |
312 | struct kstatfs tmp; | 312 | struct kstatfs tmp; |
313 | error = vfs_statfs(nd.path.dentry, &tmp); | 313 | error = vfs_statfs(path.dentry, &tmp); |
314 | if (!error) | 314 | if (!error) |
315 | error = put_compat_statfs64(buf, &tmp); | 315 | error = put_compat_statfs64(buf, &tmp); |
316 | path_put(&nd.path); | 316 | path_put(&path); |
317 | } | 317 | } |
318 | return error; | 318 | return error; |
319 | } | 319 | } |
@@ -2131,9 +2131,9 @@ asmlinkage long compat_sys_epoll_pwait(int epfd, | |||
2131 | 2131 | ||
2132 | #ifdef CONFIG_SIGNALFD | 2132 | #ifdef CONFIG_SIGNALFD |
2133 | 2133 | ||
2134 | asmlinkage long compat_sys_signalfd(int ufd, | 2134 | asmlinkage long compat_sys_signalfd4(int ufd, |
2135 | const compat_sigset_t __user *sigmask, | 2135 | const compat_sigset_t __user *sigmask, |
2136 | compat_size_t sigsetsize) | 2136 | compat_size_t sigsetsize, int flags) |
2137 | { | 2137 | { |
2138 | compat_sigset_t ss32; | 2138 | compat_sigset_t ss32; |
2139 | sigset_t tmp; | 2139 | sigset_t tmp; |
@@ -2148,9 +2148,15 @@ asmlinkage long compat_sys_signalfd(int ufd, | |||
2148 | if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t))) | 2148 | if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t))) |
2149 | return -EFAULT; | 2149 | return -EFAULT; |
2150 | 2150 | ||
2151 | return sys_signalfd(ufd, ksigmask, sizeof(sigset_t)); | 2151 | return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags); |
2152 | } | 2152 | } |
2153 | 2153 | ||
2154 | asmlinkage long compat_sys_signalfd(int ufd, | ||
2155 | const compat_sigset_t __user *sigmask, | ||
2156 | compat_size_t sigsetsize) | ||
2157 | { | ||
2158 | return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0); | ||
2159 | } | ||
2154 | #endif /* CONFIG_SIGNALFD */ | 2160 | #endif /* CONFIG_SIGNALFD */ |
2155 | 2161 | ||
2156 | #ifdef CONFIG_TIMERFD | 2162 | #ifdef CONFIG_TIMERFD |