From patchwork Fri Feb 17 12:59:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9579753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9B8DE6042F for ; Fri, 17 Feb 2017 13:00:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E0B7286C8 for ; Fri, 17 Feb 2017 13:00:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82EC3286CC; Fri, 17 Feb 2017 13:00:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2356E286C8 for ; Fri, 17 Feb 2017 13:00:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933832AbdBQNAK (ORCPT ); Fri, 17 Feb 2017 08:00:10 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:56811 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933787AbdBQNAK (ORCPT ); Fri, 17 Feb 2017 08:00:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=x0j2kyCvfQNu1WWPXVqL3QbETsHZYOEnaPBxh6t+7t8=; b=EmmKg9JwDAALOjhcfRKvc3KYm e9x0syAmd5bGW28PJtXuyU2F70n/SITcnUjagwpZwBMvhH1Jgvq275iMQcMJuMaUeEJdaPCKQQtTs cPNKGQ7KexcATzAtr6p1mXivFXKZWz8F9GGsixJG6eo49Ncs+44gsgfCvQOQf7iWXHLioXXeEzqs/ TcB09RBtdcfP+vFxxU5LUo2CV0Oj+ye56uxpFx1F0XBj7jXxA2GmTpYmPYyAg6bNksyeVnidzX2vt u3zl2L7fO9lRZmAUKxhsqBn4HpvHTjYuIUdxirCjIJHAUdsApXnmkD77V3xqJCwltDnnd6heJ7Y9+ u9lSIh7rg==; Received: from 80-109-146-114.cable.dynamic.surfer.at ([80.109.146.114] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cei8n-0000es-Fq; Fri, 17 Feb 2017 13:00:01 +0000 From: Christoph Hellwig To: scott.bauer@intel.com, keith.busch@intel.com, jonathan.derrick@intel.com, axboe@fb.com Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Subject: [PATCH 4/4] nvme: re-check security protocol support after reset Date: Fri, 17 Feb 2017 13:59:41 +0100 Message-Id: <20170217125941.14319-5-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170217125941.14319-1-hch@lst.de> References: <20170217125941.14319-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A device may change capabilities after each reset, e.g. due to a firmware upgrade. We should thus check for Security Send/Receive and OPAL support after each reset. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index ddc51adb594d..c5986850f88b 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1789,7 +1789,8 @@ static void nvme_reset_work(struct work_struct *work) if (result) goto out; - if ((dev->ctrl.oacs & NVME_CTRL_OACS_SEC_SUPP) && !dev->ctrl.opal_dev) { + kfree(dev->ctrl.opal_dev); + if (dev->ctrl.oacs & NVME_CTRL_OACS_SEC_SUPP) { dev->ctrl.opal_dev = init_opal_dev(&dev->ctrl, &nvme_sec_submit); }