Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2632101pxj; Mon, 14 Jun 2021 03:33:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNGc1j6eoNseUXmF3d7jVjwMhX+xJu0YW6y8osWkzm6SnRlOvDDrrnNehBlc9GUoYY2amr X-Received: by 2002:a05:6402:cb5:: with SMTP id cn21mr16076091edb.164.1623666813921; Mon, 14 Jun 2021 03:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623666813; cv=none; d=google.com; s=arc-20160816; b=pPAgq/9enhR6qqkvw5Plcin3LGLGALi8ADF/dHFP0jAceg3n8TKKpQsBkffqDIVVt0 H8hIb5zE0Cj+OsM6iaG6auteaNmiCdw5jiJOa4ewPOpa5Et5IHdfKrbXIJlHG74p61J9 Pk7jT/xEH2MLxtw/ij5PBhKANz3ioBXQ+Q1L+CMe74HzaOvuVoXkYZLiVgiV0klC9kRA aYYmsdeKSzdKbT69Txsb04LqLbi2x5J+9vqpO+ZiAiBtkqruAGlpKOfDMaeJpiMV5nk/ DS0FTONf3T4IuQMPpc8cFTLNyIlkpeefW9h7y4ESSqVtlI+YbMYfphxJfD/Tj7m6vhXT ss2g== 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=REomeVWQCp7UL4U6h9iEN75XBkntOXgf6Ksyyga3YM0=; b=C8Ikd+l63jPpDt/ArYld7mHyrm2zU5e/Py4v3MMVMcM45jftfTix7OG+1eVBKjs7ja wymBGl96eVYTj4BB6nQO0Sr1Jr3FEh/SxGAt9U1qx/6b8v9156ZZrse1tMp2gH+oMVHF qmp39aM9d5ibvGdqYr1Hyi31MvBeHyISR2YDEbfXG79PHGUyQukw7XgQzrS/H9Tjs4fK BSXxR4dsfK0g0n/Em+LnuCxis7jzeLk1R32KLvnA39TUXGLLVW9/lPBw17hfAST8fFrr uz5WD0VyDPn5L+PTSU5GsVwAndWY9I0A5mEXnHKtK2PDRdxR0P66Hi9A4Egd4Ct//f8r I/8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="RYgiS/IZ"; 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 ka15si11235320ejc.148.2021.06.14.03.33.11; Mon, 14 Jun 2021 03:33:33 -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="RYgiS/IZ"; 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 S232836AbhFNKdF (ORCPT + 99 others); Mon, 14 Jun 2021 06:33:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:38594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232938AbhFNKbv (ORCPT ); Mon, 14 Jun 2021 06:31:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 847B8611BE; Mon, 14 Jun 2021 10:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666589; bh=KPaqAh25fX0hFrqdDDg0IpLpr5RaI/agMsdrlMl/D2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RYgiS/IZDy3cKAHXczeK2NxacfloQGXTjg+Tsu7/byvaw82uabd6rdOm94ilLMzE+ tl37Roy1uhBHyRDU9euP7rjb0s6vSIf5eMV4IIh2NlqEHnEn7PSd3HLHTQezFQJ9qk SnUPHT5nZibwDy7/YUPswVnlIR6TmXhueawmFmHY= 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.4 33/34] scsi: core: Only put parent device if host state differs from SHOST_CREATED Date: Mon, 14 Jun 2021 12:27:24 +0200 Message-Id: <20210614102642.641326135@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102641.582612289@linuxfoundation.org> References: <20210614102641.582612289@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 kfree(shost->shost_data); - if (parent) + if (shost->shost_state != SHOST_CREATED) put_device(parent); kfree(shost); }