diff mbox series

[SRU,F,v2,1/1] UBUNTU: SAUCE: fix NULL ptr deref causing system crash

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

Commit Message

Bethany Jamison Sept. 6, 2024, 5:23 p.m. UTC
Buglink: https://bugs.launchpad.net/bugs/2077657

Fix bug LP#2077657 where an issue with tracking packets is
causing a NULL pointer dereference that causes system crashes.
This solution was proposed by Josh Hunt <johunt@akamai.com> in
the bug ticket he submitted.

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;
 }