Author: kib
Date: Wed Jan  4 16:09:45 2017
New Revision: 311286
URL: https://svnweb.freebsd.org/changeset/base/311286

Log:
  The callers of kern_getfsstat(UIO_SYSSPACE) expect that *buf always
  returns memory which must be freed, regardless of the error.  Assign
  NULL to *buf in case we are not going to allocate any memory due to
  invalid mode.
  
  Reported and tested by:       pho
  Reviewed by:  jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:    3 weeks (together with r310638)
  Differential revision:        https://reviews.freebsd.org/D9042

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c        Wed Jan  4 16:09:08 2017        
(r311285)
+++ head/sys/kern/vfs_syscalls.c        Wed Jan  4 16:09:45 2017        
(r311286)
@@ -429,6 +429,8 @@ kern_getfsstat(struct thread *td, struct
        case MNT_NOWAIT:
                break;
        default:
+               if (bufseg == UIO_SYSSPACE)
+                       *buf = NULL;
                return (EINVAL);
        }
 restart:
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to