diff mbox series

[SRU,F,1/1] fix NULL ptr deref causing system crash

Message ID 20240903201903.73774-2-bethany.jamison@canonical.com
State New
Headers show
Series fix tcp NULL ptr deref | expand

Commit Message

Bethany Jamison Sept. 3, 2024, 8:19 p.m. UTC
Buglink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2077657

Fix bug LP#2077657 where an issue with tracking packets that is
causing a NULL pointer dereference that causes system crashes.

Signed-off-by: Bethany Jamison <bethany.jamison@canonical.com>
---
 include/net/tcp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 164ba7b77bd9f..fc8d82220e4c7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -2081,7 +2081,8 @@  static inline s64 tcp_rto_delta_us(const struct sock *sk)
 {
 	const struct sk_buff *skb = tcp_rtx_queue_head(sk);
 	u32 rto = inet_csk(sk)->icsk_rto;
-	u64 rto_time_stamp_us = tcp_skb_timestamp_us(skb) + jiffies_to_usecs(rto);
+	u64 rto_time_stamp_us = skb ? tcp_skb_timestamp_us(skb) : 0 + jiffies_to_usecs(rto);
+	WARN_ON_ONCE(!skb);
 
 	return rto_time_stamp_us - tcp_sk(sk)->tcp_mstamp;
 }