misc/178016: nfsserver readdir panic, missing vnode type check

Adam Nowacki nowak at tepeserwery.pl
Sun Apr 21 03:40:01 UTC 2013


>Number:         178016
>Category:       misc
>Synopsis:       nfsserver readdir panic, missing vnode type check
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 21 03:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Adam Nowacki
>Release:        9.1-RELEASE
>Organization:
>Environment:
FreeBSD storage 9.1-RELEASE FreeBSD 9.1-RELEASE #0: Sat Feb 23 15:51:26 UTC 2013     root at storage:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
New nfs server will process READDIR on non-directories. Kernel panic is almost certain if readdir is executed on regular file.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: sys/fs/nfsserver/nfs_nfsdport.c
===================================================================
--- sys/fs/nfsserver/nfs_nfsdport.c	(revision 249437)
+++ sys/fs/nfsserver/nfs_nfsdport.c	(working copy)
@@ -1575,6 +1575,8 @@
 			nd->nd_repstat = NFSERR_BAD_COOKIE;
 #endif
 	}
+	if (!nd->nd_repstat && vp->v_type != VDIR)
+		nd->nd_repstat = NFSERR_NOTDIR;
 	if (nd->nd_repstat == 0 && cnt == 0) {
 		if (nd->nd_flag & ND_NFSV2)
 			/* NFSv2 does not have NFSERR_TOOSMALL */


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list