summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorXu Kuohai <xukuohai@huawei.com>2023-08-04 03:37:38 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-16 18:27:26 +0200
commit6b2824b198a638d5ea45df81fa9acb1699eda8b3 (patch)
treeb65920ad623dbf832feb98c6d5521e5ac7745a9e /include
parented90fe7435c573897c2ab7624f24d67c866f94a9 (diff)
downloadlinux-6b2824b198a638d5ea45df81fa9acb1699eda8b3.tar.gz
bpf, sockmap: Fix bug that strp_done cannot be called
commit 809e4dc71a0f2b8d2836035d98603694fff11d5d upstream.

strp_done is only called when psock->progs.stream_parser is not NULL,
but stream_parser was set to NULL by sk_psock_stop_strp(), called
by sk_psock_drop() earlier. So, strp_done can never be called.

Introduce SK_PSOCK_RX_ENABLED to mark whether there is strp on psock.
Change the condition for calling strp_done from judging whether
stream_parser is set to judging whether this flag is set. This flag is
only set once when strp_init() succeeds, and will never be cleared later.

Fixes: c0d95d3380ee ("bpf, sockmap: Re-evaluate proto ops when psock is removed from sockmap")
Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/r/20230804073740.194770-3-xukuohai@huaweicloud.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/skmsg.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index 054d7911bfc9..c1637515a8a4 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -62,6 +62,7 @@ struct sk_psock_progs {
 
 enum sk_psock_state_bits {
 	SK_PSOCK_TX_ENABLED,
+	SK_PSOCK_RX_STRP_ENABLED,
 };
 
 struct sk_psock_link {