Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp345360pxb; Sat, 11 Sep 2021 06:57:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhgeYsBLxMT+xfWHXcQY5i6ADo4NH7RMVDuoSvLti+XZEkx7q/eQIsWvC554KREhVsIeBD X-Received: by 2002:a05:6402:22f0:: with SMTP id dn16mr3344982edb.261.1631368642669; Sat, 11 Sep 2021 06:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631368642; cv=none; d=google.com; s=arc-20160816; b=W/rgGGonrIoXTgW1myA1g8NyhYzIneqtM9hyoFHYAIhpnVZPk/U8f/IcQ2OGI4N3G0 XIZQF5hp0qRgO0UK5S/NJ3vYBrRsXvI6CSZKXhCGYfsoxFTpaLICopTVzwrDpH4pBDgd y0lUshYrxHXlYS4H6AOlhCVazY1KBf7mObQgvGg9OmW4Q+4vtB5/8/F3rePzOGsHodDO wUTOgnyO7I4cNIWS/TIlZdwM1PLPTxmbxEW+vJfF28BArU+lzPMRPLkzb1IudlBj8c3E dzbS5QpPa1SccXtVTEbyHpT9x5QWsXN7jSKQ5TnEmz50OpH2y6VuhxtYZoNLGRtgxskD Pjsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=vM0/gzEBgPOCxeWrAPOozBGHIar+EzqaOM5Z/0ZHWtM=; b=QYjGcfYkOBCWASBSxiE6sZ7R2wy6rStu55DHwmU2DmFPOjEL0kL45KT6ohO1Ee1eIT tSYH15oZZOGgEUCWdtfpW9IrfJ+TbHyRYwuE606cjbAER0nFguyradTlEkfWNXFHy1SC iNP1P5I0yJfm1ij/Gtr6LcX7zNWGXE6qnf5xPYX2BW2gdkXavBo5Le8nvOuwuZ/HhQn8 WEbESZF5SRVec+9TEFnMfbq918DkEtK1LFO5+g1phkOIbvgM2HFjBlNPXVpokYO4DYcA dqveu8tYUJklS2WS1kECpssWO3UuCXZjqi8UQhRQNJ/P/mgpOAQ1zccXIuXhweWqFw0k OIlQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si1846010edr.232.2021.09.11.06.56.59; Sat, 11 Sep 2021 06:57:22 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235941AbhIKN4e (ORCPT + 99 others); Sat, 11 Sep 2021 09:56:34 -0400 Received: from mail-m17642.qiye.163.com ([59.111.176.42]:37164 "EHLO mail-m17642.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbhIKN4d (ORCPT ); Sat, 11 Sep 2021 09:56:33 -0400 Received: from localhost.localdomain (unknown [113.116.176.115]) by mail-m17642.qiye.163.com (Hmail) with ESMTPA id 42E20220148; Sat, 11 Sep 2021 21:55:19 +0800 (CST) From: Ding Hui To: lduncan@suse.com, cleech@redhat.com, jejb@linux.ibm.com, martin.petersen@oracle.com, michael.christie@oracle.com, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ding Hui Subject: [PATCH v2] scsi: libiscsi: move init ehwait to iscsi_session_setup() Date: Sat, 11 Sep 2021 21:51:59 +0800 Message-Id: <20210911135159.20543-1-dinghui@sangfor.com.cn> X-Mailer: git-send-email 2.17.1 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWRlJTRlWH00YQkhCGRhDGh lKVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWU9LSFVKSktISkNVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Mkk6FQw5MD4XDhxCQxcpMRIp NTkwCTVVSlVKTUhKSE1DTkpCQ0pJVTMWGhIXVR8SFRwTDhI7CBoVHB0UCVUYFBZVGBVFWVdZEgtZ QVlKSkhVSkpNVUpMTVVKSk5ZV1kIAVlBSUhMTzcG X-HM-Tid: 0a7bd5241f57d998kuws42e20220148 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The commit ec29d0ac29be ("scsi: iscsi: Fix conn use after free during resets") move member ehwait from conn to session, but left init ehwait in iscsi_conn_setup(). Although a session can only have 1 conn currently, it is better to do init ehwait in iscsi_session_setup() to prevent reinit by mistake, also in case we can handle multiple conns in the future. Fixes: ec29d0ac29be ("scsi: iscsi: Fix conn use after free during resets") Signed-off-by: Ding Hui --- v2: update commit log drivers/scsi/libiscsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 4683c183e9d4..712a45368385 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2947,6 +2947,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, session->tmf_state = TMF_INITIAL; timer_setup(&session->tmf_timer, iscsi_tmf_timedout, 0); mutex_init(&session->eh_mutex); + init_waitqueue_head(&session->ehwait); spin_lock_init(&session->frwd_lock); spin_lock_init(&session->back_lock); @@ -3074,8 +3075,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, goto login_task_data_alloc_fail; conn->login_task->data = conn->data = data; - init_waitqueue_head(&session->ehwait); - return cls_conn; login_task_data_alloc_fail: -- 2.17.1