[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241128183509.23236-2-n.zhandarovich@fintech.ru>
Date: Thu, 28 Nov 2024 10:35:09 -0800
From: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Sasha Levin
<sashal@...nel.org>, <stable@...r.kernel.org>
CC: Nikita Zhandarovich <n.zhandarovich@...tech.ru>, Boris Pismenny
<borisp@...dia.com>, John Fastabend <john.fastabend@...il.com>, "Daniel
Borkmann" <daniel@...earbox.net>, Jakub Kicinski <kuba@...nel.org>, "David
S. Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH 5.4/5.10/5.15 1/1] net/tls: tls_is_tx_ready() checked list_entry
From: Pietro Borrello <borrello@...g.uniroma1.it>
[ Upstream commit ffe2a22562444720b05bdfeb999c03e810d84cbb ]
tls_is_tx_ready() checks that list_first_entry() does not return NULL.
This condition can never happen. For empty lists, list_first_entry()
returns the list_entry() of the head, which is a type confusion.
Use list_first_entry_or_null() which returns NULL in case of empty
lists.
Fixes: a42055e ("net/tls: Add support for async encryption of records for performance")
Signed-off-by: Pietro Borrello <borrello@...g.uniroma1.it>
Link: https://lore.kernel.org/r/20230128-list-entry-null-check-tls-v1-1-525bbfe6f0d0@diag.uniroma1.it
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
[Nikita: since tls_is_tx_ready() exists only as is_tx_ready() in
include/net/tls.h, fix the issue there instead.]
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
---
include/net/tls.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/tls.h b/include/net/tls.h
index 7f220e03ebb2..e6836a5dfb6e 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -427,7 +427,7 @@ static inline bool is_tx_ready(struct tls_sw_context_tx *ctx)
{
struct tls_rec *rec;
- rec = list_first_entry(&ctx->tx_list, struct tls_rec, list);
+ rec = list_first_entry_or_null(&ctx->tx_list, struct tls_rec, list);
if (!rec)
return false;
--
2.25.1
Powered by blists - more mailing lists