[PATCH 4/5] compat_sys_clock_nanosleep: fix *rmtp handling for -EINTR case

From: Oleg Nesterov
Date: Fri Feb 01 2008 - 08:36:27 EST


COMPLETELY UNTESTED.

compat_sys_clock_nanosleep() update rmtp only if err == -ERESTART_RESTARTBLOCK.
This is wrong, nanosleep() can return -EINTR if flags & TIMER_ABSTIME.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>

--- MM/kernel/compat.c~4_COMPAT_CLOCK 2008-02-01 14:50:01.000000000 +0300
+++ MM/kernel/compat.c 2008-02-01 15:05:28.000000000 +0300
@@ -618,8 +618,7 @@ static long compat_clock_nanosleep_resta
err = clock_nanosleep_restart(restart);
set_fs(oldfs);

- if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
- put_compat_timespec(&tu, rmtp))
+ if (err && rmtp && put_compat_timespec(&tu, rmtp))
return -EFAULT;

if (err == -ERESTART_RESTARTBLOCK) {
@@ -648,8 +647,7 @@ long compat_sys_clock_nanosleep(clockid_
(struct timespec __user *) &out);
set_fs(oldfs);

- if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
- put_compat_timespec(&out, rmtp))
+ if (err && rmtp && put_compat_timespec(&out, rmtp))
return -EFAULT;

if (err == -ERESTART_RESTARTBLOCK) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/