Received: by 10.192.165.156 with SMTP id m28csp224517imm; Tue, 17 Apr 2018 09:06:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx49A9ALQ+HPlFQGQkUFZ/JeMY9Cax3arQ6nvCAlqaZNjyW+3QyhkThKmlWh7u0hehncOYSrY X-Received: by 10.98.58.24 with SMTP id h24mr2506861pfa.209.1523981163947; Tue, 17 Apr 2018 09:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523981163; cv=none; d=google.com; s=arc-20160816; b=elMOWwpD23vgNEpOCpOXHOvkNxKoX26KvfotO+4FRXygRvHfw+d8qgShmmI5ScDwBR QudN3eEEkC0jBSzRJtWagayn4Gwun8qpmzuhC6nvlkCS3XrG13JJo5zVFDM2PCT3AObv 1DLP1GAMDeiEFMqwUwxGSHGnXjLQOSuOohzQIoOh4dw3Xoo4H3TGimAp41rBAt/1N+Dz NiFcxyKJ5iQpUiC48yEeSSDHwuucJQgIHc1TFNOhlIpmgnAu+drjzwfWruDXHP8lpQLO RUPVGLK1gtvD7j7uumVffouK0bCeU2ev/fzECUA2Ful3A8dL7AGcXjVmCF8cMuTI4PKW cL9g== 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=lz0HrZPNY2Q0yXjI1lGneforxefSuvYDEloGI8p/mio=; b=IbAHFST+iTl3s8O0kNbjxYusd37nNht95YZ7CLwJhr1ANQvh7hzwH2eKWOPlpeDbzH JIWV2kxcRpNdJOalCwTrKf5RXBCgTmYkhwsTQf5XJqAos9WoWXPGikN733RuAjKv2OEh RMs5WlvWf/hOwkdjv49WXdLXNhBLmSu16DGnDffKzQ0ZlX7oCznivBxtwPrJbbsQUqwt ycI4wIEmzjj+z4zqnfXF7mLGJu3Rio8GfdSeSmVe2Lbi3lV7s+zea5mUo6DJeoW38Lj1 TkHf02hmoz65vnIv5YQMzSz7liGg3Nnq2Qen/teMTnefqe78UYaH2bP2wsIxXg1aLYKw MtHw== 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 n7si5332414pgt.480.2018.04.17.09.05.49; Tue, 17 Apr 2018 09:06:03 -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 S1753957AbeDQQEO (ORCPT + 99 others); Tue, 17 Apr 2018 12:04:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33348 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752568AbeDQQEK (ORCPT ); Tue, 17 Apr 2018 12:04:10 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D6BE4F2C; Tue, 17 Apr 2018 16:04:08 +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.15 29/53] nvme: Skip checking heads without namespaces Date: Tue, 17 Apr 2018 17:58:54 +0200 Message-Id: <20180417155724.573672858@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155723.091120060@linuxfoundation.org> References: <20180417155723.091120060@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.15-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 @@ -2720,6 +2720,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; }