Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/tmpfs tmpfs_dir_getdents: avoid leaking kernel memory...
details: https://anonhg.NetBSD.org/src/rev/6d614f26979c
branches: trunk
changeset: 791411:6d614f26979c
user: rmind <rmind%NetBSD.org@localhost>
date: Sat Nov 16 17:58:27 2013 +0000
description:
tmpfs_dir_getdents: avoid leaking kernel memory to the userspace.
>From Pedro Martelletto.
XXX: regress/sys/fs/getdents should be a part of the test suite
diffstat:
sys/fs/tmpfs/tmpfs_subr.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 4cccf0422d31 -r 6d614f26979c sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Sat Nov 16 17:18:42 2013 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Sat Nov 16 17:58:27 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_subr.c,v 1.86 2013/11/11 17:04:06 rmind Exp $ */
+/* $NetBSD: tmpfs_subr.c,v 1.87 2013/11/16 17:58:27 rmind Exp $ */
/*
* Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.86 2013/11/11 17:04:06 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.87 2013/11/16 17:58:27 rmind Exp $");
#include <sys/param.h>
#include <sys/cprng.h>
@@ -788,7 +788,7 @@
* Allocate struct dirent and first check for the "." and "..".
* Note: tmpfs_dir_getdotents() will "seek" for us.
*/
- dentp = kmem_alloc(sizeof(struct dirent), KM_SLEEP);
+ dentp = kmem_zalloc(sizeof(struct dirent), KM_SLEEP);
if (uio->uio_offset == TMPFS_DIRSEQ_DOT) {
if ((error = tmpfs_dir_getdotents(node, dentp, uio)) != 0) {
Home |
Main Index |
Thread Index |
Old Index