svn commit: r346432 - stable/12/sys/kern
Mark Johnston
markj at FreeBSD.org
Sat Apr 20 10:56:57 UTC 2019
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;
More information about the svn-src-stable-12
mailing list