Module Name: src
Committed By: martin
Date: Sun Aug 4 11:19:03 UTC 2019
Modified Files:
src/sys/net [netbsd-8]: bpf.c
Log Message:
Pull up following revision(s) (requested by maxv in ticket #1323):
sys/net/bpf.c: revision 1.229
Fix info leak: use kmem_zalloc, because we align the buffers, and the
otherwise uninitialized padding bytes get copied to userland in bpf_read().
To generate a diff of this commit:
cvs rdiff -u -r1.216.6.6 -r1.216.6.7 src/sys/net/bpf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.216.6.6 src/sys/net/bpf.c:1.216.6.7
--- src/sys/net/bpf.c:1.216.6.6 Tue May 15 13:48:37 2018
+++ src/sys/net/bpf.c Sun Aug 4 11:19:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.216.6.6 2018/05/15 13:48:37 martin Exp $ */
+/* $NetBSD: bpf.c,v 1.216.6.7 2019/08/04 11:19:03 martin Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.216.6.6 2018/05/15 13:48:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.216.6.7 2019/08/04 11:19:03 martin Exp $");
#if defined(_KERNEL_OPT)
#include "opt_bpf.h"
@@ -1969,10 +1969,10 @@ static int
bpf_allocbufs(struct bpf_d *d)
{
- d->bd_fbuf = kmem_alloc(d->bd_bufsize, KM_NOSLEEP);
+ d->bd_fbuf = kmem_zalloc(d->bd_bufsize, KM_NOSLEEP);
if (!d->bd_fbuf)
return (ENOBUFS);
- d->bd_sbuf = kmem_alloc(d->bd_bufsize, KM_NOSLEEP);
+ d->bd_sbuf = kmem_zalloc(d->bd_bufsize, KM_NOSLEEP);
if (!d->bd_sbuf) {
kmem_free(d->bd_fbuf, d->bd_bufsize);
return (ENOBUFS);