linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: Ding Hui <dinghui@sangfor.com.cn>,
	lduncan@suse.com, cleech@redhat.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, open-iscsi@googlegroups.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] scsi: libiscsi: move init ehwait to iscsi_session_setup()
Date: Fri, 10 Sep 2021 11:25:26 -0500	[thread overview]
Message-ID: <03817f8e-8fed-6e7a-e76f-8608f8cfd979@oracle.com> (raw)
In-Reply-To: <20210910010220.24073-2-dinghui@sangfor.com.cn>

On 9/9/21 8:02 PM, Ding Hui wrote:
> 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().
> 
> Due to one session can be binded by multi conns, the conn after the

A session can only have 1 conn. There is some code that makes it look
like we can do multiple conns or swap the single conn, but it was never
fully implemented/supported upstream.

However, I like the patch. The init should be done in iscsi_session_setup,
so could you fix up the commit, so it's correct?

> first will reinit the session->ehwait, move init ehwait to
> iscsi_session_setup() to fix it.
> 
> Fixes: ec29d0ac29be ("scsi: iscsi: Fix conn use after free during resets")
> Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
> ---
>  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:
> 


  reply	other threads:[~2021-09-10 16:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10  1:02 [RESEND] [PATCH 0/3] fix several bugs about libiscsi Ding Hui
2021-09-10  1:02 ` [PATCH 1/3] scsi: libiscsi: move init ehwait to iscsi_session_setup() Ding Hui
2021-09-10 16:25   ` Mike Christie [this message]
2021-09-11  9:37     ` Ding Hui
2021-09-10  1:02 ` [PATCH 2/3] scsi: libiscsi: fix invalid pointer dereference in iscsi_eh_session_reset Ding Hui
2021-09-10 16:38   ` Mike Christie
2021-09-11  9:52     ` Ding Hui
2021-09-10  1:02 ` [PATCH 3/3] scsi: libiscsi: get ref to conn in iscsi_eh_device/target_reset() Ding Hui
2021-09-10 16:46   ` Mike Christie
  -- strict thread matches above, loose matches on Subject: below --
2021-09-09 15:47 [PATCH 1/3] scsi: libiscsi: move init ehwait to iscsi_session_setup() Ding Hui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03817f8e-8fed-6e7a-e76f-8608f8cfd979@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=cleech@redhat.com \
    --cc=dinghui@sangfor.com.cn \
    --cc=jejb@linux.ibm.com \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=open-iscsi@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).