From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Lu Tixiong <lutianxiong@huawei.com>,
Mike Christie <michael.christie@oracle.com>,
Lee Duncan <lduncan@suse.com>, Lixiaokeng <lixiaokeng@huawei.com>,
Linfeilong <linfeilong@huawei.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.4 10/14] scsi: libiscsi: Fix UAF in iscsi_conn_get_param()/iscsi_conn_teardown()
Date: Mon, 10 Jan 2022 08:22:49 +0100 [thread overview]
Message-ID: <20220110071812.111657061@linuxfoundation.org> (raw)
In-Reply-To: <20220110071811.779189823@linuxfoundation.org>
From: Lixiaokeng <lixiaokeng@huawei.com>
[ Upstream commit 1b8d0300a3e9f216ae4901bab886db7299899ec6 ]
|- iscsi_if_destroy_conn |-dev_attr_show
|-iscsi_conn_teardown
|-spin_lock_bh |-iscsi_sw_tcp_conn_get_param
|-kfree(conn->persistent_address) |-iscsi_conn_get_param
|-kfree(conn->local_ipaddr)
==>|-read persistent_address
==>|-read local_ipaddr
|-spin_unlock_bh
When iscsi_conn_teardown() and iscsi_conn_get_param() happen in parallel, a
UAF may be triggered.
Link: https://lore.kernel.org/r/046ec8a0-ce95-d3fc-3235-666a7c65b224@huawei.com
Reported-by: Lu Tixiong <lutianxiong@huawei.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
Signed-off-by: Linfeilong <linfeilong@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/libiscsi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 0713d02cf1126..b1ef1aa4dd44b 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2994,6 +2994,8 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
{
struct iscsi_conn *conn = cls_conn->dd_data;
struct iscsi_session *session = conn->session;
+ char *tmp_persistent_address = conn->persistent_address;
+ char *tmp_local_ipaddr = conn->local_ipaddr;
del_timer_sync(&conn->transport_timer);
@@ -3015,8 +3017,6 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
spin_lock_bh(&session->frwd_lock);
free_pages((unsigned long) conn->data,
get_order(ISCSI_DEF_MAX_RECV_SEG_LEN));
- kfree(conn->persistent_address);
- kfree(conn->local_ipaddr);
/* regular RX path uses back_lock */
spin_lock_bh(&session->back_lock);
kfifo_in(&session->cmdpool.queue, (void*)&conn->login_task,
@@ -3028,6 +3028,8 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
mutex_unlock(&session->eh_mutex);
iscsi_destroy_conn(cls_conn);
+ kfree(tmp_persistent_address);
+ kfree(tmp_local_ipaddr);
}
EXPORT_SYMBOL_GPL(iscsi_conn_teardown);
--
2.34.1
next prev parent reply other threads:[~2022-01-10 7:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 7:22 [PATCH 4.4 00/14] 4.4.299-rc1 review Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 01/14] bpf, test: fix ld_abs + vlan push/pop stress test Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 02/14] Bluetooth: btusb: Apply QCA Rome patches for some ATH3012 models Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 03/14] ieee802154: atusb: fix uninit value in atusb_set_extended_addr Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 04/14] mac80211: initialize variable have_higher_than_11mbit Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 05/14] i40e: Fix incorrect netdevs real number of RX/TX queues Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 06/14] sch_qfq: prevent shift-out-of-bounds in qfq_init_qdisc Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 07/14] xfs: map unwritten blocks in XFS_IOC_{ALLOC,FREE}SP just like fallocate Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 08/14] rndis_host: support Hytera digital radios Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 09/14] phonet: refcount leak in pep_sock_accep Greg Kroah-Hartman
2022-01-10 7:22 ` Greg Kroah-Hartman [this message]
2022-01-10 7:22 ` [PATCH 4.4 11/14] ip6_vti: initialize __ip6_tnl_parm struct in vti6_siocdevprivate Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 12/14] net: udp: fix alignment problem in udp4_seq_show() Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 13/14] mISDN: change function names to avoid conflicts Greg Kroah-Hartman
2022-01-10 7:22 ` [PATCH 4.4 14/14] power: reset: ltc2952: Fix use of floating point literals Greg Kroah-Hartman
2022-01-10 11:49 ` [PATCH 4.4 00/14] 4.4.299-rc1 review Jon Hunter
2022-01-10 23:00 ` Shuah Khan
2022-01-10 23:48 ` Guenter Roeck
2022-01-11 8:45 ` Naresh Kamboju
2022-01-11 11:34 ` Pavel Machek
2022-01-12 9:18 ` Greg Kroah-Hartman
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=20220110071812.111657061@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=lduncan@suse.com \
--cc=linfeilong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lixiaokeng@huawei.com \
--cc=lutianxiong@huawei.com \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=sashal@kernel.org \
--cc=stable@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.