Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Apr 2019 10:56:56 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r346432 - stable/12/sys/kern
Message-ID:  <201904201056.x3KAuuxt085512@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Sat Apr 20 10:56:56 2019
New Revision: 346432
URL: https://svnweb.freebsd.org/changeset/base/346432

Log:
  MFC r345513:
  Reject F_SETLK_REMOTE commands when sysid == 0.

Modified:
  stable/12/sys/kern/kern_descrip.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_descrip.c
==============================================================================
--- stable/12/sys/kern/kern_descrip.c	Sat Apr 20 07:32:29 2019	(r346431)
+++ stable/12/sys/kern/kern_descrip.c	Sat Apr 20 10:56:56 2019	(r346432)
@@ -602,7 +602,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_
 
 	case F_SETLK_REMOTE:
 		error = priv_check(td, PRIV_NFS_LOCKD);
-		if (error)
+		if (error != 0)
 			return (error);
 		flg = F_REMOTE;
 		goto do_setlk;
@@ -613,6 +613,12 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_
 
 	case F_SETLK:
 	do_setlk:
+		flp = (struct flock *)arg;
+		if ((flg & F_REMOTE) != 0 && flp->l_sysid == 0) {
+			error = EINVAL;
+			break;
+		}
+
 		error = fget_unlocked(fdp, fd, &cap_flock_rights, &fp, NULL);
 		if (error != 0)
 			break;
@@ -622,7 +628,6 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_
 			break;
 		}
 
-		flp = (struct flock *)arg;
 		if (flp->l_whence == SEEK_CUR) {
 			foffset = foffset_get(fp);
 			if (foffset < 0 ||
@@ -668,10 +673,6 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_
 			    flp, flg);
 			break;
 		case F_UNLCKSYS:
-			/*
-			 * Temporary api for testing remote lock
-			 * infrastructure.
-			 */
 			if (flg != F_REMOTE) {
 				error = EINVAL;
 				break;



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