sock: fix possible NULL sk dereference in __skb_tstamp_tx
Subsystems (2)
PATCH 1/1 sock: fix possible NULL sk dereference in __skb_tstamp_tx
From: Willem de Bruijn <[email protected]>
Test that sk != NULL before reading sk->sk_tsflags.
Fixes 49ca0d8bfaf3 ("net-timestamp: no-payload option")
Reported-by One Thousand Gnomes <[email protected]>
Signed-off-by Willem de Bruijn <[email protected]>
--- net/core/skbuff.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/skbuff.c +6 -2
@@ -3689,9 +3689,13 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, struct sock *sk, int tstype) {struct sk_buff *skb; -bool tsonly = sk->sk_tsflags &SOF_TIMESTAMPING_OPT_TSONLY ; +bool tsonly; -if (!sk || !skb_may_tx_timestamp (sk, tsonly)) +if (!sk) +return ; + + tsonly = sk->sk_tsflags &SOF_TIMESTAMPING_OPT_TSONLY ; +if (!skb_may_tx_timestamp (sk, tsonly))return ;if (tsonly)
Signature · 1 line
2.2.0.rc0.207.ga3a616c
From: Willem de Bruijn <[email protected]>
Date: Wed, 11 Mar 2015 15:43:55 -0400
Quoted 8 lines
From: Willem de Bruijn <[email protected]>
Test that sk != NULL before reading
sk->sk_tsflags.Fixes 49ca0d8bfaf3 ("net-timestamp: no-payload option")Reported-by One Thousand Gnomes <[email protected]>Signed-off-by Willem de Bruijn <[email protected]>
Applied, thanks Willem.