Date: Thu, 5 Sep 2019 23:07:57 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351907 - stable/12/sys/dev/nvme Message-ID: <201909052307.x85N7vZ7029208@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Thu Sep 5 23:07:57 2019 New Revision: 351907 URL: https://svnweb.freebsd.org/changeset/base/351907 Log: MFC r351411: When we have errors resetting the device before we allocate the queues, don't try to tear them down in the ctrlr_destroy path. Otherwise, we dereference queue structures that are NULL and we trap. Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_ctrlr.c Thu Sep 5 23:04:37 2019 (r351906) +++ stable/12/sys/dev/nvme/nvme_ctrlr.c Thu Sep 5 23:07:57 2019 (r351907) @@ -1211,12 +1211,14 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev if (ctrlr->cdev) destroy_dev(ctrlr->cdev); - if (!gone) - nvme_ctrlr_destroy_qpairs(ctrlr); - for (i = 0; i < ctrlr->num_io_queues; i++) - nvme_io_qpair_destroy(&ctrlr->ioq[i]); - free(ctrlr->ioq, M_NVME); - nvme_admin_qpair_destroy(&ctrlr->adminq); + if (ctrlr->is_initialized) { + if (!gone) + nvme_ctrlr_destroy_qpairs(ctrlr); + for (i = 0; i < ctrlr->num_io_queues; i++) + nvme_io_qpair_destroy(&ctrlr->ioq[i]); + free(ctrlr->ioq, M_NVME); + nvme_admin_qpair_destroy(&ctrlr->adminq); + } /* * Notify the controller of a shutdown, even though this is due to
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909052307.x85N7vZ7029208>