public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Suzuki Poulose <suzuki@in.ibm.com>
To: akpm@linux-foundation.org
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] Fix compat_sys_utimensat
Date: Fri, 28 Aug 2009 15:18:45 +0530	[thread overview]
Message-ID: <4A97A7FD.1000202@in.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]


Hi,

The compat_utimensat syscall does not ignore tv_sec field when tv_nsec 
is set to UTIME_OMIT/UTIME_NOW and returns -EINVAL.

This problem was revealed with the utimensat_tests from LTP.

The utimensat() syscall works fine.

Attaching a patch for the issue. The patch has been tested and verified 
to fix the issue.

Please apply.

Thanks,

Suzuki

[-- Attachment #2: fix-compat-utimensat-syscall.diff --]
[-- Type: text/plain, Size: 920 bytes --]

Compat utimensat() returns EINVAL when the tv_nsec is one of UTIME_OMIT or UTIME_NOW and
the tv_sec is set to non-zero. As per man pages, the tv_sec field should be ignored.

The sys_utimensat() works fine in this case.

Signed-off-by: Suzuki K P <suzuki@in.ibm.com>

Index: linux-2.6.31-rc7/fs/compat.c
===================================================================
--- linux-2.6.31-rc7.orig/fs/compat.c	2009-08-22 06:30:46.000000000 +0530
+++ linux-2.6.31-rc7/fs/compat.c	2009-08-28 14:14:32.781364904 +0530
@@ -100,13 +100,6 @@
 		    get_compat_timespec(&tv[1], &t[1]))
 			return -EFAULT;
 
-		if ((tv[0].tv_nsec == UTIME_OMIT || tv[0].tv_nsec == UTIME_NOW)
-		    && tv[0].tv_sec != 0)
-			return -EINVAL;
-		if ((tv[1].tv_nsec == UTIME_OMIT || tv[1].tv_nsec == UTIME_NOW)
-		    && tv[1].tv_sec != 0)
-			return -EINVAL;
-
 		if (tv[0].tv_nsec == UTIME_OMIT && tv[1].tv_nsec == UTIME_OMIT)
 			return 0;
 	}

             reply	other threads:[~2009-08-28  9:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-28  9:48 Suzuki Poulose [this message]
2009-09-01  7:34 ` [PATCH] Fix compat_sys_utimensat Suzuki Poulose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A97A7FD.1000202@in.ibm.com \
    --to=suzuki@in.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox