diff options
author | John Baldwin <jhb@FreeBSD.org> | 2022-02-11 23:16:25 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2022-02-11 23:16:25 +0000 |
commit | cd0525f615fe8fea750d2078b61026aabe0d0471 (patch) | |
tree | d657dea20403abd1c2ba394b31ba9358ca5f4807 /sys/kern/uipc_ktls.c | |
parent | fd8d4e53bc2ac424d6f08ac700800093b03a2d97 (diff) | |
download | src-cd0525f615fe8fea750d2078b61026aabe0d0471.tar.gz src-cd0525f615fe8fea750d2078b61026aabe0d0471.zip |
ktls: Write-lock the INP when changing a transmit TLS session.
The TCP rate pacing code relies on being able to read this pointer
safely while holding an INP lock. The initial TLS session pointer is
set while holding the write lock already.
Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34086
Diffstat (limited to 'sys/kern/uipc_ktls.c')
-rw-r--r-- | sys/kern/uipc_ktls.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 2495e940a6a0..466b64d01386 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1454,6 +1454,7 @@ ktls_set_tx_mode(struct socket *so, int mode) return (EBUSY); } + INP_WLOCK(inp); SOCKBUF_LOCK(&so->so_snd); so->so_snd.sb_tls_info = tls_new; if (tls_new->mode != TCP_TLS_MODE_SW) @@ -1475,7 +1476,6 @@ ktls_set_tx_mode(struct socket *so, int mode) else counter_u64_add(ktls_switch_to_sw, 1); - INP_WLOCK(inp); return (0); } |