ipvs: orphan_skb in tunnel transmit case
Subsystems (3)
PATCH 1/1 ipvs: orphan_skb in tunnel transmit case
It's possible that the sk came from early_demux. This will blow up every time in the TCP_TIME_WAIT case in ip_local_out. No similar crashes exist for masquerade or gateway because they do not use ip_local_out{,6}.
--- net/netfilter/ipvs/ip_vs_xmit.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/netfilter/ipvs/ip_vs_xmit.c +7 -0
@@ -521,6 +521,13 @@ static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb,if (unlikely (cp->flags &IP_VS_CONN_F_NFCT )) ret =ip_vs_confirm_conntrack (skb);if (ret ==NF_ACCEPT ) { +/* In this case, skb is associated with an old, receiving +* socket, which may be in TIME-WAIT and invalid for the +* forward path, so we orphan it. +*/ +if (skb->dev) +skb_orphan (skb); +nf_reset (skb);skb_forward_csum (skb); }
Signature · 1 line
Alex Gartrell <[email protected]>
Julian Anastasov
maintainerHello,
Quoted 3 lines · Alex Gartrell
It's possible that the sk came from
early_demux. This will blow up every time in theTCP_TIME_WAITcase inip_local_out. No similar crashes exist for masquerade or gateway because they do not use ip_local_out{,6}.
May be it is better to do it for all kind of
forwarding methods:
http://archive.linuxvirtualserver.org/html/lvs-devel/2015-01/msg00018.html
http://archive.linuxvirtualserver.org/html/lvs-devel/2015-01/msg00032.html
By this way, skb->destructor can be safely changed
in output path (eg. in ip_fragment) while for input path sock_edemux should be called where sk_state is properly checked in sock_gen_put.
Quoted 13 lines
Signed-off-by Alex Gartrell <[email protected]>--- net/netfilter/ipvs/ip_vs_xmit.c | 7 +++++++ 1 file changed, 7 insertions(+)net/netfilter/ipvs/ip_vs_xmit.c +0
-0@@ -521,6 +521,13 @@ static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb,if (unlikely (cp->flags &IP_VS_CONN_F_NFCT )) ret =ip_vs_confirm_conntrack (skb);if (ret ==NF_ACCEPT ) {
net/netfilter/ipvs/ip_vs_xmit.c static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb, · line 533
Quoted 10 lines
net/netfilter/ipvs/ip_vs_xmit.c +7
-0+/* In this case, skb is associated with an old, receiving +* socket, which may be in TIME-WAIT and invalid for the +* forward path, so we orphan it. +*/ +if (skb->dev) +skb_orphan (skb); +nf_reset (skb);skb_forward_csum (skb); }
Regards
--
Julian Anastasov <[email protected]>