svn commit: r353279 - releng/12.1/sys/kern

Mark Johnston markj at FreeBSD.org
Mon Oct 7 15:26:40 UTC 2019


Author: markj
Date: Mon Oct  7 15:26:40 2019
New Revision: 353279
URL: https://svnweb.freebsd.org/changeset/base/353279

Log:
  MFS r353276:
  Disallow fcntl(F_READAHEAD) when the vnode is not a regular file.
  
  Approved by:	re (gjb)

Modified:
  releng/12.1/sys/kern/kern_descrip.c
Directory Properties:
  releng/12.1/   (props changed)

Modified: releng/12.1/sys/kern/kern_descrip.c
==============================================================================
--- releng/12.1/sys/kern/kern_descrip.c	Mon Oct  7 15:25:00 2019	(r353278)
+++ releng/12.1/sys/kern/kern_descrip.c	Mon Oct  7 15:26:40 2019	(r353279)
@@ -770,6 +770,12 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_
 			break;
 		}
 		vp = fp->f_vnode;
+		if (vp->v_type != VREG) {
+			fdrop(fp, td);
+			error = ENOTTY;
+			break;
+		}
+
 		/*
 		 * Exclusive lock synchronizes against f_seqcount reads and
 		 * writes in sequential_heuristic().


More information about the svn-src-all mailing list