Date: Sun, 21 Apr 2013 03:35:58 GMT From: Adam Nowacki <nowak@tepeserwery.pl> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/178016: nfsserver readdir panic, missing vnode type check Message-ID: <201304210335.r3L3Zwo6062533@red.freebsd.org> Resent-Message-ID: <201304210340.r3L3e1i6090398@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304210335.r3L3Zwo6062533>
