diff options
author | Maxim Mikityanskiy <[email protected]> | 2022-05-12 12:18:30 +0300 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2022-05-12 10:01:36 -0700 |
commit | 3740651bf7e200109dd42d5b2fb22226b26f960a (patch) | |
tree | 642623aed22f6d728acd0e129891856c10cdfcac /lib/mpi/mpi-sub-ui.c | |
parent | 1fa89ffbc04545b7582518e57f4b63e2a062870f (diff) |
tls: Fix context leak on tls_device_down
The commit cited below claims to fix a use-after-free condition after
tls_device_down. Apparently, the description wasn't fully accurate. The
context stayed alive, but ctx->netdev became NULL, and the offload was
torn down without a proper fallback, so a bug was present, but a
different kind of bug.
Due to misunderstanding of the issue, the original patch dropped the
refcount_dec_and_test line for the context to avoid the alleged
premature deallocation. That line has to be restored, because it matches
the refcount_inc_not_zero from the same function, otherwise the contexts
that survived tls_device_down are leaked.
This patch fixes the described issue by restoring refcount_dec_and_test.
After this change, there is no leak anymore, and the fallback to
software kTLS still works.
Fixes: c55dcdd435aa ("net/tls: Fix use-after-free after the TLS device goes down and up")
Signed-off-by: Maxim Mikityanskiy <[email protected]>
Reviewed-by: Tariq Toukan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions