From: Vincent Pelletier <plr.vincent@gmail.com>
To: target-devel@vger.kernel.org
Subject: Re: iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails
Date: Wed, 15 Aug 2018 10:23:46 +0000 [thread overview]
Message-ID: <20180815102346.3ad09f89@gmail.com> (raw)
In-Reply-To: <009ea1a88311492e651c38ae946f785961a7e1a7.1534328354.git.plr.vincent@gmail.com>
On Wed, 15 Aug 2018 10:19:14 +0000, Vincent Pelletier
<plr.vincent@gmail.com> wrote:
> Fixes a use-after-free reported by KASAN when later
> iscsi_target_login_sess_out gets called and it tries to access
> conn->sess->se_sess:
I could still hit this issue by causing a timeout, and located the
guilty kfree:
> ret = iscsi_login_set_conn_values(sess, conn, pdu->cid);
Here, conn->sess is set.
> - if (unlikely(ret)) {
> - kfree(sess);
This is the guilty kfree.
> + ret = -ENOMEM;
This is just to be strictly compliant with the hardcoded return value
which I'm replacing with "ret". I tend to think this is wrong (hiding
a possibly more relevant error code ?), but I do not know the
surrounding code nearly enough to make a decision - so status-quo it is.
Regards,
--
Vincent Pelletier
next prev parent reply other threads:[~2018-08-15 10:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-15 10:19 iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails Vincent Pelletier
2018-08-15 10:23 ` Vincent Pelletier [this message]
2018-08-15 15:44 ` Mike Christie
2018-08-15 15:57 ` Vincent Pelletier
2018-08-15 15:57 ` Mike Christie
2018-08-15 15:59 ` Mike Christie
2018-08-15 20:30 ` Mike Christie
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=20180815102346.3ad09f89@gmail.com \
--to=plr.vincent@gmail.com \
--cc=target-devel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.