Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jan 2016 17:53:32 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r293591 - stable/10/sys/compat/linux
Message-ID:  <201601091753.u09HrWHg068222@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sat Jan  9 17:53:32 2016
New Revision: 293591
URL: https://svnweb.freebsd.org/changeset/base/293591

Log:
  MFC r283491:
  
  Properly check tv_nsec value. The tv_nsec field can also be one
  of the special value UTIME_NOW or UTIME_OMIT.

Modified:
  stable/10/sys/compat/linux/linux_misc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/10/sys/compat/linux/linux_misc.c	Sat Jan  9 17:52:27 2016	(r293590)
+++ stable/10/sys/compat/linux/linux_misc.c	Sat Jan  9 17:53:32 2016	(r293591)
@@ -139,6 +139,9 @@ struct l_pselect6arg {
 	l_size_t	ss_len;
 };
 
+static int	linux_utimensat_nsec_valid(l_long);
+
+
 int
 linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
 {
@@ -823,6 +826,17 @@ linux_utimes(struct thread *td, struct l
 	return (error);
 }
 
+static int
+linux_utimensat_nsec_valid(l_long nsec)
+{
+
+	if (nsec == LINUX_UTIME_OMIT || nsec == LINUX_UTIME_NOW)
+		return (0);
+	if (nsec >= 0 && nsec <= 999999999)
+		return (0);
+	return (1);
+}
+
 int 
 linux_utimensat(struct thread *td, struct linux_utimensat_args *args)
 {
@@ -846,8 +860,8 @@ linux_utimensat(struct thread *td, struc
 		if (error != 0)
 			return (error);
 
-		if (l_times[0].tv_nsec > 999999999 ||
-			l_times[1].tv_nsec > 999999999)
+		if (linux_utimensat_nsec_valid(l_times[0].tv_nsec) != 0 ||
+		    linux_utimensat_nsec_valid(l_times[1].tv_nsec) != 0)
 			return (EINVAL);
 
 		times[0].tv_sec = l_times[0].tv_sec;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601091753.u09HrWHg068222>