Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net bpf(4): Nix KM_NOSLEEP and prune dead branch.



details:   https://anonhg.NetBSD.org/src/rev/00015d1ca9c9
branches:  trunk
changeset: 363443:00015d1ca9c9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Mar 12 17:23:32 2022 +0000

description:
bpf(4): Nix KM_NOSLEEP and prune dead branch.

https://syzkaller.appspot.com/bug?id=0fa7029d5565d9670a24c364d44bd116c76d7e7f

diffstat:

 sys/net/bpf.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r 2d0824751c4d -r 00015d1ca9c9 sys/net/bpf.c
--- a/sys/net/bpf.c     Sat Mar 12 17:15:04 2022 +0000
+++ b/sys/net/bpf.c     Sat Mar 12 17:23:32 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf.c,v 1.244 2022/03/12 16:19:08 riastradh Exp $      */
+/*     $NetBSD: bpf.c,v 1.245 2022/03/12 17:23:32 riastradh Exp $      */
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.244 2022/03/12 16:19:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.245 2022/03/12 17:23:32 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -2136,9 +2136,8 @@
 _bpfattach(struct ifnet *ifp, u_int dlt, u_int hdrlen, struct bpf_if **driverp)
 {
        struct bpf_if *bp;
-       bp = kmem_alloc(sizeof(*bp), KM_NOSLEEP);
-       if (bp == NULL)
-               panic("%s: out of memory", __func__);
+
+       bp = kmem_alloc(sizeof(*bp), KM_SLEEP);
 
        mutex_enter(&bpf_mtx);
        bp->bif_driverp = driverp;



Home | Main Index | Thread Index | Old Index