Skip to contentSkip to conversation

ipvs: fix reversed sequence option serialization

PATCH In review Kyle Zeng 2 participants 2 messages Aug 10 – Aug 11

Subsystems (4)
lore
Share & tools
lore

Kyle Zeng

author
#0 lore raw

PATCH 1/1 ipvs: fix reversed sequence option serialization

hton_seq() expects the host-order source first and the unaligned network-order destination second. The version 1 sync sender passes these arguments in reverse for both sequence blocks. This leaves 24 bytes of the kmalloc-backed message unwritten. It may disclose stale heap data and replace the live connection sequence state with values read from the buffer.

Pass the connection sequence state as the source and the message payload as the destination for both blocks.

Fixes 986a07579533 ("IPVS: Backup, Change sending to Version 1 format")
Assisted-by Codex:gpt-5.6-sol
---
 net/netfilter/ipvs/ip_vs_sync.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_sync.c +2 -2
index 93038abbf..f6ea6c953 100644
@@ -747,9 +747,9 @@ sloop:
 	if (cp->flags & IP_VS_CONN_F_SEQ_MASK) {
 		*(p++) = IPVS_OPT_SEQ_DATA;
 		*(p++) = sizeof(struct ip_vs_sync_conn_options);
-		hton_seq((struct ip_vs_seq *)p, &cp->in_seq);
+		hton_seq(&cp->in_seq, (struct ip_vs_seq *)p);
 		p += sizeof(struct ip_vs_seq);
-		hton_seq((struct ip_vs_seq *)p, &cp->out_seq);
+		hton_seq(&cp->out_seq, (struct ip_vs_seq *)p);
 		p += sizeof(struct ip_vs_seq);
 	}
 	/* Handle pe data */
Signature · 1 line
2.53.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hello,

Quoted 7 lines · Kyle Zeng

hton_seq() expects the host-order source first and the unaligned network-order destination second. The version 1 sync sender passes these arguments in reverse for both sequence blocks. This leaves 24 bytes of the kmalloc-backed message unwritten. It may disclose stale heap data and replace the live connection sequence state with values read from the buffer.

Quoted 6 lines

Pass the connection sequence state as the source and the message payload as the destination for both blocks.

Fixes 986a07579533 ("IPVS: Backup, Change sending to Version 1 format")
Assisted-by Codex:gpt-5.6-sol

Looks good to me for the nf tree, thanks!

Quoted 22 lines
---
 net/netfilter/ipvs/ip_vs_sync.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_sync.c +2 -2
index 93038abbf..f6ea6c953 100644
@@ -747,9 +747,9 @@ sloop:
 	if (cp->flags & IP_VS_CONN_F_SEQ_MASK) {
 		*(p++) = IPVS_OPT_SEQ_DATA;
 		*(p++) = sizeof(struct ip_vs_sync_conn_options);
-		hton_seq((struct ip_vs_seq *)p, &cp->in_seq);
+		hton_seq(&cp->in_seq, (struct ip_vs_seq *)p);
 		p += sizeof(struct ip_vs_seq);
-		hton_seq((struct ip_vs_seq *)p, &cp->out_seq);
+		hton_seq(&cp->out_seq, (struct ip_vs_seq *)p);
 		p += sizeof(struct ip_vs_seq);
 	}
 	/* Handle pe data */
Signature · 1 line
2.53.0

Regards

--
Julian Anastasov <[email protected]>