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

Bethany Jamison bethany.jamison at canonical.com
Tue Sep 3 20:19:03 UTC 2024


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 at canonical.com>
---
 include/net/tcp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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




More information about the kernel-team mailing list