提交 89b8465d 编写于 作者: P Pietro Borrello 提交者: Jialin Zhang

net/tls: tls_is_tx_ready() checked list_entry

mainline inclusion
from mainline-v6.2-rc7
commit ffe2a225
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I6I7U2
CVE: CVE-2023-1075

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=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: a42055e8 ("net/tls: Add support for async encryption of records for performance")
Signed-off-by: NPietro Borrello <borrello@diag.uniroma1.it>
Link: https://lore.kernel.org/r/20230128-list-entry-null-check-tls-v1-1-525bbfe6f0d0@diag.uniroma1.itSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Conflicts:
	net/tls/tls_sw.c
Signed-off-by: NZiyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Reviewed-by: NWang Weiyang <wangweiyang2@huawei.com>
Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
上级 60ec03fa
...@@ -441,7 +441,7 @@ static inline bool is_tx_ready(struct tls_sw_context_tx *ctx) ...@@ -441,7 +441,7 @@ static inline bool is_tx_ready(struct tls_sw_context_tx *ctx)
{ {
struct tls_rec *rec; 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) if (!rec)
return false; return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册