From: Alexandr Andreev <aandreev@openvz.org> Add VERIFY_WRITE check in the beginning like compat_sys_getdents() (EINVAL vs EFAULT). Signed-off-by: Alexandr Andreev <aandreev@openvz.org> Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org> Cc: "Luck, Tony" <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> --- arch/ia64/ia32/sys_ia32.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff -puN arch/ia64/ia32/sys_ia32.c~ia64-sync-compat-getdents-on-ia64-and-parisc arch/ia64/ia32/sys_ia32.c --- a/arch/ia64/ia32/sys_ia32.c~ia64-sync-compat-getdents-on-ia64-and-parisc +++ a/arch/ia64/ia32/sys_ia32.c @@ -1267,6 +1267,10 @@ sys32_getdents (unsigned int fd, struct struct getdents32_callback buf; int error; + error = -EFAULT; + if (!access_ok(VERIFY_WRITE, dirent, count)) + goto out; + error = -EBADF; file = fget(fd); if (!file) @@ -1283,10 +1287,10 @@ sys32_getdents (unsigned int fd, struct error = buf.error; lastdirent = buf.previous; if (lastdirent) { - error = -EINVAL; if (put_user(file->f_pos, &lastdirent->d_off)) - goto out_putf; - error = count - buf.count; + error = -EFAULT; + else + error = count - buf.count; } out_putf: _ - To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Tue Mar 06 21:35:57 2007
This archive was generated by hypermail 2.1.8 : 2007-03-06 21:40:12 EST