Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2017 16:09:45 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311286 - head/sys/kern
Message-ID:  <201701041609.v04G9juf068756@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701041609.v04G9juf068756>