[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210712061021.906071469@linuxfoundation.org>
Date: Mon, 12 Jul 2021 08:08:57 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Jiang Wang <jiang.wang@...edance.com>,
Cong Wang <cong.wang@...edance.com>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Jakub Sitnicki <jakub@...udflare.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.13 514/800] skmsg: Clear skb redirect pointer before dropping it
From: Cong Wang <cong.wang@...edance.com>
[ Upstream commit 30b9c54a707db4155735cf71f4600241c1b7b6ff ]
When we drop skb inside sk_psock_skb_redirect(), we have to clear
its skb->_sk_redir pointer too, otherwise kfree_skb() would
misinterpret it as a valid skb->_skb_refdst and dst_release()
would eventually complain.
Fixes: e3526bb92a20 ("skmsg: Move sk_redir from TCP_SKB_CB to skb")
Reported-by: Jiang Wang <jiang.wang@...edance.com>
Signed-off-by: Cong Wang <cong.wang@...edance.com>
Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
Acked-by: John Fastabend <john.fastabend@...il.com>
Acked-by: Jakub Sitnicki <jakub@...udflare.com>
Link: https://lore.kernel.org/bpf/20210615021342.7416-5-xiyou.wangcong@gmail.com
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
net/core/skmsg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 43ce17a6a585..df545748cd6a 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -866,12 +866,14 @@ static void sk_psock_skb_redirect(struct sk_buff *skb)
* a socket that is in this state so we drop the skb.
*/
if (!psock_other || sock_flag(sk_other, SOCK_DEAD)) {
+ skb_bpf_redirect_clear(skb);
kfree_skb(skb);
return;
}
spin_lock_bh(&psock_other->ingress_lock);
if (!sk_psock_test_state(psock_other, SK_PSOCK_TX_ENABLED)) {
spin_unlock_bh(&psock_other->ingress_lock);
+ skb_bpf_redirect_clear(skb);
kfree_skb(skb);
return;
}
--
2.30.2
Powered by blists - more mailing lists