svn commit: r353124 - stable/11/sys/kern

Mark Johnston markj at FreeBSD.org
Sat Oct 5 14:56:28 UTC 2019


Author: markj
Date: Sat Oct  5 14:56:27 2019
New Revision: 353124
URL: https://svnweb.freebsd.org/changeset/base/353124

Log:
  MFC r353010:
  Disallow fcntl(F_READAHEAD) when the vnode is not a regular file.

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

Modified: stable/11/sys/kern/kern_descrip.c
==============================================================================
--- stable/11/sys/kern/kern_descrip.c	Sat Oct  5 13:28:01 2019	(r353123)
+++ stable/11/sys/kern/kern_descrip.c	Sat Oct  5 14:56:27 2019	(r353124)
@@ -765,6 +765,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-stable mailing list