Commit c6a5424a authored by Maxim Mikityanskiy's avatar Maxim Mikityanskiy Committed by Ziyang Xuan
Browse files

net/tls: Remove the context from the list in tls_device_down

mainline inclusion
from mainline-v5.19
commit f6336724
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I990AF


CVE: CVE-2021-47131

--------------------------------

tls_device_down takes a reference on all contexts it's going to move to
the degraded state (software fallback). If sk_destruct runs afterwards,
it can reduce the reference counter back to 1 and return early without
destroying the context. Then tls_device_down will release the reference
it took and call tls_device_free_ctx. However, the context will still
stay in tls_device_down_list forever. The list will contain an item,
memory for which is released, making a memory corruption possible.

Fix the above bug by properly removing the context from all lists before
any call to tls_device_free_ctx.

Fixes: 3740651b ("tls: Fix context leak on tls_device_down")
Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
parent b931292e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment