Source-Changes-HG archive

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

src: Pull up following revision(s) (requested by msaitoh in tick...



details:   https://anonhg.NetBSD.org/src/rev/aee1e37de295
branches:  netbsd-8
changeset: 317941:aee1e37de295
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Apr 09 13:23:29 2018 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #718):
        sys/dev/ic/nvme.c: revision 1.32
- don't leak ccb on alloc failure.
- KASSERT to prevent memory leak.

diffstat:

 sys/dev/ic/nvme.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 071a2de4a7d8 -r aee1e37de295 sys/dev/ic/nvme.c
--- a/sys/dev/ic/nvme.c Mon Apr 09 12:54:34 2018 +0000
+++ b/sys/dev/ic/nvme.c Mon Apr 09 13:23:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvme.c,v 1.30.2.2 2018/03/18 11:05:27 martin Exp $     */
+/*     $NetBSD: nvme.c,v 1.30.2.3 2018/04/09 13:23:29 bouyer Exp $     */
 /*     $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.2 2018/03/18 11:05:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.3 2018/04/09 13:23:29 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -570,8 +570,10 @@
        KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */
 
        mem = nvme_dmamem_alloc(sc, sizeof(*identify));
-       if (mem == NULL)
+       if (mem == NULL) {
+               nvme_ccb_put(sc->sc_admin_q, ccb);
                return ENOMEM;
+       }
 
        memset(&sqe, 0, sizeof(sqe));
        sqe.opcode = NVM_ADMIN_IDENTIFY;
@@ -601,6 +603,7 @@
 
        ns = nvme_ns_get(sc, nsid);
        KASSERT(ns);
+       KASSERT(ns->ident == NULL);
        ns->ident = identify;
 
 done:



Home | Main Index | Thread Index | Old Index