[PATCH 0/2] Avoid overlapping mempcy() in DUP_ACK handling
Spotted this so-far harmless, but technically undefined behaviour while looking at other things. Fixed one other nit at the same time. David Gibson (2): tcp: Remove redundant initialisation of iov[TCP_IOV_ETH].iov_base tcp: Avoid overlapping memcpy() in DUP_ACK handling tcp_buf.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.46.0
This initialisation for IPv4 flags buffers is redundant with the very next
line which sets both iov_base and iov_len.
Signed-off-by: David Gibson
When handling the DUP_ACK flag, we copy all the buffers making up the ack
frame. However, all our frames share the same buffer for the Ethernet
header (tcp4_eth_src or tcp6_eth_src), so copying the TCP_IOV_ETH will
result in a (perfectly) overlapping memcpy(). This seems to have been
harmless so far, but overlapping ranges to memcpy() is undefined behaviour,
so we really should avoid it.
Signed-off-by: David Gibson
On Thu, 12 Sep 2024 16:59:38 +1000
David Gibson
Spotted this so-far harmless, but technically undefined behaviour while looking at other things. Fixed one other nit at the same time.
David Gibson (2): tcp: Remove redundant initialisation of iov[TCP_IOV_ETH].iov_base tcp: Avoid overlapping memcpy() in DUP_ACK handling
tcp_buf.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Applied. -- Stefano
participants (2)
-
David Gibson
-
Stefano Brivio