public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Saravanan Vajravel <saravanan.vajravel@broadcom.com>
To: Sagi Grimberg <sagi@grimberg.me>,
	Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	OFED mailing list <linux-rdma@vger.kernel.org>
Cc: Ehab Ababneh <ehab.ababneh@cornelisnetworks.com>,
	Selvin Xavier <selvin.xavier@broadcom.com>,
	leon@kernel.org
Subject: RE: isert patch leaving resources behind
Date: Wed, 16 Aug 2023 17:03:51 +0530	[thread overview]
Message-ID: <2e2978cdc824c20f212708139c8b2af7@mail.gmail.com> (raw)
In-Reply-To: <94a8b56d-0f9e-b75b-78d7-753122dcb3b0@grimberg.me>

[-- Attachment #1: Type: text/plain, Size: 2406 bytes --]

>> You should look at the DEVICE_REMOVAL cm handler, it should call
>> iscsit_cause_connection_reinstatement. I do think that it needs to pass
>> it sleep=true (for device removal) so that it will wait for
>> conn_wait_comp...
Ok. So it should take care of current resource leak issue. Right?

Thanks & Regards,
Saravanan Vajravel
+91-80-46116256

-----Original Message-----
From: Sagi Grimberg <sagi@grimberg.me>
Sent: Monday, August 14, 2023 6:07 PM
To: Saravanan Vajravel <saravanan.vajravel@broadcom.com>; Dennis Dalessandro
<dennis.dalessandro@cornelisnetworks.com>; OFED mailing list
<linux-rdma@vger.kernel.org>
Cc: Ehab Ababneh <ehab.ababneh@cornelisnetworks.com>; Selvin Xavier
<selvin.xavier@broadcom.com>; leon@kernel.org
Subject: Re: isert patch leaving resources behind



On 8/14/23 14:20, Saravanan Vajravel wrote:
> Hi Sagi,
>
> In surprise removal case as well, isert_free_conn() should get invoked
> by iSCSI target module. Right? I am trying to understand how the
> kernel object leak is possible.  In your proposed patch, isert_conn is
> released in
> isert_wait_conn() handler. Again, isert module tries to release the
> connection in isert_free_conn() handler as well. Hence it will lead
> use-after-free issue.
>
> Following are the snippet of iSCSI functions where iscsit_wait_conn()
> and
> iscsit_free_conn() handlers are invoked in files iscsi_target_login.c
> & iscsi_target.c. We need to review if there is a possibility that
> iscsit_free_conn() is not invoked in any case. If yes, we may have to
> fix that.
>
> void  iscsi_target_login_sess_out
> {
> .
> .
> .
> 	if (conn->conn_transport->iscsit_wait_conn)
> 		conn->conn_transport->iscsit_wait_conn(conn);
>
> 	if (conn->conn_transport->iscsit_free_conn)
> 		conn->conn_transport->iscsit_free_conn(conn);
> .
> }
>
> int iscsit_close_connection(
> 	struct iscsit_conn *conn)
> {
> .
> .
> .
> 	if (conn->conn_transport->iscsit_wait_conn)
> 		conn->conn_transport->iscsit_wait_conn(conn);
> .
> .
> .
> 	if (conn->conn_transport->iscsit_free_conn)
> 		conn->conn_transport->iscsit_free_conn(conn);
> .
> .
> }
>
> @Leon,
>
> I don't have the kernel logs in hand now. We can reproduce the issue
> and share.

You should look at the DEVICE_REMOVAL cm handler, it should call
iscsit_cause_connection_reinstatement. I do think that it needs to pass it
sleep=true (for device removal) so that it will wait for conn_wait_comp...

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4227 bytes --]

      reply	other threads:[~2023-08-16 11:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 14:44 isert patch leaving resources behind Dennis Dalessandro
2023-08-13  8:29 ` Leon Romanovsky
2023-08-20  9:46   ` Leon Romanovsky
2023-08-20 14:46     ` Sagi Grimberg
2023-08-20 17:33       ` Leon Romanovsky
2023-08-21 10:47         ` Saravanan Vajravel
2023-08-21 11:30           ` Dennis Dalessandro
2023-08-13 14:18 ` Sagi Grimberg
2023-08-14 11:20   ` Saravanan Vajravel
2023-08-14 12:36     ` Sagi Grimberg
2023-08-16 11:33       ` Saravanan Vajravel [this message]

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=2e2978cdc824c20f212708139c8b2af7@mail.gmail.com \
    --to=saravanan.vajravel@broadcom.com \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=ehab.ababneh@cornelisnetworks.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sagi@grimberg.me \
    --cc=selvin.xavier@broadcom.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