From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751599AbcKAP2u (ORCPT ); Tue, 1 Nov 2016 11:28:50 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:55549 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbcKAP2r (ORCPT ); Tue, 1 Nov 2016 11:28:47 -0400 X-IronPort-AV: E=Sophos;i="5.31,580,1473120000"; d="scan'208";a="181582488" Date: Tue, 1 Nov 2016 16:27:56 +0100 From: Rashika Kheria To: linux-kernel@vger.kernel.org Subject: [PATCH] NVMe: Call nvme_pci_disable on error path of nvme_probe_work Message-ID: <20161101152756.GA32044@ub8ca3ab5e3235612a6d0.ant.amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit d5537e988eec ("NVMe: Don't unmap controller registers on reset"), introduced a regression in which it did not replace nvme_dev_unmap() with nvme_pci_disable() in the error path of nvme_probe_work(). This led to the following NVMe driver crash on systems where the devices did not initialise in the first try. BUG: unable to handle kernel paging request at ffffc90006da001c IP: [] nvme_dev_remove+0x5b/0xf0 [nvme] RIP: e030:[] [] nvme_dev_remove+0x5b/0xf0 [nvme] RSP: e02b:ffff8806659c3cb8 EFLAGS: 00010286 RAX: ffffc90006da0000 RBX: ffff88067cbc3000 RCX: 0000000000000006 RDX: 0000000000000007 RSI: 0000000000000007 RDI: ffff8806864eda40 RBP: ffff8806659c3cd8 R08: 0000000000000006 R09: 000000000000fffe R10: 0000000000000000 R11: 0000000000000000 R12: ffff88067e087000 R13: ffffffffa0281d20 R14: ffff88067e087098 R15: ffff8806799d8598 FS: 00007f880d5ba700(0000) GS:ffff8806864e0000(0000) knlGS:0000000000000000 CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffc90006da001c CR3: 0000000676a97000 CR4: 0000000000042660 Call Trace: [] nvme_remove+0x9a/0x140 [nvme] [] pci_device_remove+0x3f/0xc0 [] ? __pm_runtime_idle+0x89/0x90 [] __device_release_driver+0xaf/0x140 [] device_release_driver+0x28/0x40 [] unbind_store+0x96/0xb0 [] drv_attr_store+0x27/0x30 [] sysfs_kf_write+0x39/0x40 [] kernfs_fop_write+0xe4/0x160 [] __vfs_write+0x2f/0x100 [] ? syscall_slow_exit_work+0x140/0x180 [] ? vm_mmap_pgoff+0xb9/0xe0 [] ? percpu_down_read+0x11/0x60 [] vfs_write+0xbe/0x190 [] SyS_write+0x51/0xb0 [] entry_SYSCALL_64_fastpath+0x12/0x71 Cc: stable@vger.kernel.org # 4.4.y Cc: Jens Axboe Cc: Keith Busch Cc: Gabriel Krisman Bertazi Cc: linux-nvme@lists.infradead.org Fixes: d5537e988eec ("NVMe: Don't unmap controller registers on reset") Signed-off-by: Rashika Kheria --- drivers/nvme/host/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index c851bc5..f5d1579 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3184,7 +3184,7 @@ static void nvme_probe_work(struct work_struct *work) nvme_disable_queue(dev, 0); nvme_dev_list_remove(dev); unmap: - nvme_dev_unmap(dev); + nvme_pci_disable(dev); out: if (!work_busy(&dev->reset_work)) nvme_dead_ctrl(dev); -- 2.10.2