Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Add missing NULL check for pool_get call with PR...



details:   https://anonhg.NetBSD.org/src/rev/8e0f4ffdd40e
branches:  trunk
changeset: 824056:8e0f4ffdd40e
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Sun May 21 08:36:22 2017 +0000

description:
Add missing NULL check for pool_get call with PR_NOWAIT

This should fix a kernel panic reported by wiz@ on current-users ML:
  http://mail-index.netbsd.org/current-users/2017/05/03/msg031646.html

diffstat:

 sys/netinet/wqinput.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r 08ac0a7c4d85 -r 8e0f4ffdd40e sys/netinet/wqinput.c
--- a/sys/netinet/wqinput.c     Sun May 21 07:06:51 2017 +0000
+++ b/sys/netinet/wqinput.c     Sun May 21 08:36:22 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wqinput.c,v 1.1 2017/02/02 02:52:10 ozaki-r Exp $      */
+/*     $NetBSD: wqinput.c,v 1.2 2017/05/21 08:36:22 ozaki-r Exp $      */
 
 /*-
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -249,6 +249,11 @@
        }
 
        work = pool_get(&wqi->wqi_work_pool, PR_NOWAIT);
+       if (work == NULL) {
+               wwl->wwl_dropped++;
+               m_freem(m);
+               goto out;
+       }
        work->ww_mbuf = m;
        work->ww_off = off;
        work->ww_proto = proto;



Home | Main Index | Thread Index | Old Index