Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2640266pxj; Mon, 14 Jun 2021 03:46:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAPFUfZGfqRsv6EXn2sLlJAleo78Q5/roz0/YjsuhS3SgZnqrzTKTZR8BuTXKeGC3SVH0l X-Received: by 2002:a17:906:17c4:: with SMTP id u4mr14934637eje.481.1623667611968; Mon, 14 Jun 2021 03:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623667611; cv=none; d=google.com; s=arc-20160816; b=MK85zc/Y9fjE6Yvt2kDrmgetwkFGPAmGEY/mJFWWiR0mfKmdj6jK4F/QyJ6guLVL1D /kcv+bEcWK96G8DR9Tz1XuYySeqYloaOIj7/PYkhiSrUrjCfstal6xD2Y9s//quqeBqN 94+vp3z1h5VJWYO3YN0obIRVFM+/sepwlNafSE5pAToe8Ewo4foaCxBxmVNzOMdkuWsC rgWH/1+eByPka5vvvVipF/Rkaa0fU1a3PYV5EVgPDYgsXg83sGcQoaPXfVBFro6GBbH9 qfqqYstAN4pWJkpIyIzj1HDiS1G5jEzBdCJGH8KK21Ym+38qsTW9SumDiLut6JLZpQuB zlCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E1EbGaMKaWTOP3h1x4QuZMAwch1Ej7YJ59IqhqCMksE=; b=0bawprYF/ooGCrW5+cO1K43TNezXeYL90YbOBcc3Z6nQUVucOUoZoL9IiX6XKrupR9 mY7A8sG+7RusNufhhrSZQEHcWHNXmkrGI4EUjrOIOgmpYIT+sak6i5sPsWMlldD1focH lNMUHa1iHNexIy67Af9OwLTcCTEhhJO8I1yKs6IAYWfi1p27M/7eNvR/RYUUt6j6jtSC aqbsD+Vr7fgBsWWokqgXuq5qDu5UzW4cGQXU0ZMsfp7JcpL+jpvdWx7WdwKBiEgn8IgE kucMk/OapPzsaSO1UQJGNrx2duqVpEr6ICj5YCWZ1bYYfUWnqfTNagBbmCniuFYWEufv vpmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lmx4d1Nn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s2si11387465ejj.704.2021.06.14.03.46.26; Mon, 14 Jun 2021 03:46:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lmx4d1Nn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234304AbhFNKow (ORCPT + 99 others); Mon, 14 Jun 2021 06:44:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:45914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233826AbhFNKiS (ORCPT ); Mon, 14 Jun 2021 06:38:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C4D2613D9; Mon, 14 Jun 2021 10:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666835; bh=xWEwteo7NPXPsxqEdDDHdF/rrWH2BGQ2zXlGiNMmXxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lmx4d1NnGi+IPP3Flzz22CzSh6ZXY8XV56LxoKjJ6lq0soIzztkJUJWE/qv5qqf7K Kj74FDD2J+LNrTvT0s+/fJMBJ8XOCaGmavlbEYil4A8sGtIIfECw/8zPZqDvi31iRO vsxZOxbYVsE6aq7NoW9kY6FyRHXnLouIMaeG7DLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , John Garry , Hannes Reinecke , Ming Lei , "Martin K. Petersen" Subject: [PATCH 4.14 47/49] scsi: core: Only put parent device if host state differs from SHOST_CREATED Date: Mon, 14 Jun 2021 12:27:40 +0200 Message-Id: <20210614102643.394116029@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102641.857724541@linuxfoundation.org> References: <20210614102641.857724541@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ming Lei commit 1e0d4e6225996f05271de1ebcb1a7c9381af0b27 upstream. get_device(shost->shost_gendev.parent) is called after host state has switched to SHOST_RUNNING. scsi_host_dev_release() shouldn't release the parent device if host state is still SHOST_CREATED. Link: https://lore.kernel.org/r/20210602133029.2864069-5-ming.lei@redhat.com Cc: Bart Van Assche Cc: John Garry Cc: Hannes Reinecke Tested-by: John Garry Reviewed-by: John Garry Signed-off-by: Ming Lei Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/hosts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -355,7 +355,7 @@ static void scsi_host_dev_release(struct ida_simple_remove(&host_index_ida, shost->host_no); - if (parent) + if (shost->shost_state != SHOST_CREATED) put_device(parent); kfree(shost); }