Received: by 10.192.165.156 with SMTP id m28csp288098imm; Tue, 17 Apr 2018 10:07:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Gq5+jCExNjSYhV0RGlvYbRILajqufB+aCPxSPEuAR8pFY1t4aVvG6R5HcXAsskJHzLmzo X-Received: by 2002:a17:902:274a:: with SMTP id j10-v6mr1522921plg.393.1523984874899; Tue, 17 Apr 2018 10:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523984874; cv=none; d=google.com; s=arc-20160816; b=EMCask2I2y8hYtuHA4RFlf4Y2EsdoZ18baxA9w+2xrAvvoWNJHBWKQKIrUN8oWSMEZ UDCyCh8B5rgST24nxI3rojzfWiyWijy1k35mfhUuzdMwwu10wnSPhmoaw03uRcwgvMRg wUUxMvWD2I0pD+KzuifS3iT6Jpc1FlmiOJ+OwrXa4GqpKwp7mfrgSQylaI8tGUBYfVwX L6KvHG+I+N1DNaHO2sO7ZUBljPMrj0x6T/EF1Q+53wKwEaUXYP6zVj3gfyTGvwVTUVBN 6l8Zr/5TstYEGagAz6Qnvm90EbgkTRWRFjJrMTxORXIJAlOqDIoHUjFhz5cuagLgYpXK i3kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=r9dRDVxqLp/rQ9c2RS4q/WqTxOpytch3nWGFjL01Atk=; b=jphWdi/LcowHAeM2c1au883SI+6jEVt8W101O01JnDMo9MK2gZDh7hxXVFvmcVEOO/ Muhcsr+9Oekd28ABX0Jq3vDn1mU6xMpsldvRvbNvi+v/f9msGX/z20oJ8CGsrQbLebhP C9eyWDsmQiZH2poFAgnpZblWqQYHhffah+tq5rGoVIF5ONNh5lx44EKEJ6hcewWrkywR /PPR9c0ZYkKDPSjiW0QpKVzHOmUJJ8wmyT8DfB4dek/O6HFFLe8hlaeNw4eguW998h7q CMjmSVLS+m9o5E1+Y3+Gw20Ja7KkbzDGkZbW1zyfPQQkBjDAVNvWn/TJeeR1/tBTgBju F2EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t191si1061556pgc.509.2018.04.17.10.07.39; Tue, 17 Apr 2018 10:07:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753971AbeDQRFf (ORCPT + 99 others); Tue, 17 Apr 2018 13:05:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60400 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753603AbeDQQBS (ORCPT ); Tue, 17 Apr 2018 12:01:18 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 64F76DF6; Tue, 17 Apr 2018 16:01:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Gagniuc , Keith Busch , Max Gurtovoy , Christoph Hellwig , Jens Axboe Subject: [PATCH 4.16 37/68] nvme: Skip checking heads without namespaces Date: Tue, 17 Apr 2018 17:57:50 +0200 Message-Id: <20180417155750.840111905@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155749.341779147@linuxfoundation.org> References: <20180417155749.341779147@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Keith Busch commit 2079699c10c8c60a9572540c2f77d045abf036eb upstream. If a task is holding a reference to a namespace on a removed controller, the head will not be released. If the same controller is added again later, its namespaces may not be successfully added. Instead, the user will see kernel message "Duplicate IDs for nsid ". This patch fixes that by skipping heads that don't have namespaces when considering if a new namespace is safe to add. Reported-by: Alex Gagniuc Cc: stable@vger.kernel.org Signed-off-by: Keith Busch Reviewed-by: Max Gurtovoy Reviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/core.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2793,6 +2793,7 @@ static int __nvme_check_ids(struct nvme_ list_for_each_entry(h, &subsys->nsheads, entry) { if (nvme_ns_ids_valid(&new->ids) && + !list_empty(&h->list) && nvme_ns_ids_equal(&new->ids, &h->ids)) return -EINVAL; }