diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2005-11-22 00:32:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-22 12:13:43 -0500 |
commit | 86e07ce71a8aad5074f7316f9b297d2137630283 (patch) | |
tree | ee1b37dd5bda4868fb3eb0dd34dd446fe73d8141 /fs/compat.c | |
parent | f3d48f0373c14a6203202f7b1dfc7b0d8aaf6ed2 (diff) |
[PATCH] Fix error handling with put_compat_statfs()
In fs/compat.c, whenever put_compat_statfs() returns an error, the
containing syscall returns -EFAULT. This is presumably by analogy with the
non-compat case, where any non-zero code from copy_to_user() should be
translated into an EFAULT. However, put_compat_statfs() is also return
-EOVERFLOW. The same applies for put_compat_statfs64().
This bug can be observed with a statfs() on a hugetlbfs directory.
hugetlbfs, when mounted without limits reports available, free and total
blocks as -1 (itself a bug, another patch coming). statfs() will
mysteriously return EFAULT although it's parameters are perfectly valid
addresses.
This patch causes the compat versions of statfs() and statfs64() to
correctly propogate the return values from put_compat_statfs() and
put_compat_statfs64().
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/compat.c')
-rw-r--r-- | fs/compat.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/compat.c b/fs/compat.c index 0f7abf246d32..818634120b69 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -168,8 +168,8 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs | |||
168 | if (!error) { | 168 | if (!error) { |
169 | struct kstatfs tmp; | 169 | struct kstatfs tmp; |
170 | error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); | 170 | error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); |
171 | if (!error && put_compat_statfs(buf, &tmp)) | 171 | if (!error) |
172 | error = -EFAULT; | 172 | error = put_compat_statfs(buf, &tmp); |
173 | path_release(&nd); | 173 | path_release(&nd); |
174 | } | 174 | } |
175 | return error; | 175 | return error; |
@@ -186,8 +186,8 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user | |||
186 | if (!file) | 186 | if (!file) |
187 | goto out; | 187 | goto out; |
188 | error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); | 188 | error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); |
189 | if (!error && put_compat_statfs(buf, &tmp)) | 189 | if (!error) |
190 | error = -EFAULT; | 190 | error = put_compat_statfs(buf, &tmp); |
191 | fput(file); | 191 | fput(file); |
192 | out: | 192 | out: |
193 | return error; | 193 | return error; |
@@ -236,8 +236,8 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s | |||
236 | if (!error) { | 236 | if (!error) { |
237 | struct kstatfs tmp; | 237 | struct kstatfs tmp; |
238 | error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); | 238 | error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); |
239 | if (!error && put_compat_statfs64(buf, &tmp)) | 239 | if (!error) |
240 | error = -EFAULT; | 240 | error = put_compat_statfs64(buf, &tmp); |
241 | path_release(&nd); | 241 | path_release(&nd); |
242 | } | 242 | } |
243 | return error; | 243 | return error; |
@@ -257,8 +257,8 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c | |||
257 | if (!file) | 257 | if (!file) |
258 | goto out; | 258 | goto out; |
259 | error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); | 259 | error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); |
260 | if (!error && put_compat_statfs64(buf, &tmp)) | 260 | if (!error) |
261 | error = -EFAULT; | 261 | error = put_compat_statfs64(buf, &tmp); |
262 | fput(file); | 262 | fput(file); |
263 | out: | 263 | out: |
264 | return error; | 264 | return error; |