Author: kib
Date: Sat Jun 20 04:39:52 2020
New Revision: 362426
URL: https://svnweb.freebsd.org/changeset/base/362426

Log:
  MFC r311286:
  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.

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

Modified: stable/11/sys/kern/vfs_syscalls.c
==============================================================================
--- stable/11/sys/kern/vfs_syscalls.c   Sat Jun 20 04:27:38 2020        
(r362425)
+++ stable/11/sys/kern/vfs_syscalls.c   Sat Jun 20 04:39:52 2020        
(r362426)
@@ -409,6 +409,8 @@ kern_getfsstat(struct thread *td, struct statfs **buf,
        case MNT_NOWAIT:
                break;
        default:
+               if (bufseg == UIO_SYSSPACE)
+                       *buf = NULL;
                return (EINVAL);
        }
 restart:
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to