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
This commit is contained in:
parent
a94dccbe27
commit
6c4338f2ef
@ -429,6 +429,8 @@ kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
|
||||
case MNT_NOWAIT:
|
||||
break;
|
||||
default:
|
||||
if (bufseg == UIO_SYSSPACE)
|
||||
*buf = NULL;
|
||||
return (EINVAL);
|
||||
}
|
||||
restart:
|
||||
|
Loading…
x
Reference in New Issue
Block a user