[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221117104132.119843-1-lujialin4@huawei.com>
Date: Thu, 17 Nov 2022 18:41:32 +0800
From: Lu Jialin <lujialin4@...wei.com>
To: Boris Pismenny <borisp@...dia.com>,
John Fastabend <john.fastabend@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
"Paolo Abeni" <pabeni@...hat.com>,
Aviad Yehezkel <aviadye@...lanox.com>,
"Ilya Lesokhin" <ilyal@...lanox.com>
CC: Lu Jialin <lujialin4@...wei.com>, <linux-kernel@...r.kernel.org>,
<netdev@...r.kernel.org>
Subject: [PATCH] net/tls: Fix possible UAF in tls_set_device_offload
In tls_set_device_offload(), the error path "goto release_lock" will
not remove start_marker_record->list from offload_ctx->records_list,
but start_marker_record will be freed, then list traversal may cause UAF.
This fixes the following smatch warning:
net/tls/tls_device.c:1241 tls_set_device_offload() warn: '&start_marker_record->list' not removed from list
Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
Signed-off-by: Lu Jialin <lujialin4@...wei.com>
---
net/tls/tls_device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index a03d66046ca3..2def20870c58 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1234,6 +1234,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
up_read(&device_offload_lock);
clean_acked_data_disable(inet_csk(sk));
crypto_free_aead(offload_ctx->aead_send);
+ list_del(&start_marker_record->list);
free_offload_ctx:
kfree(offload_ctx);
ctx->priv_ctx_tx = NULL;
--
2.17.1
Powered by blists - more mailing lists