Commit 3a8dd971 authored by Willem de Bruijn's avatar Willem de Bruijn Committed by David S. Miller

sock: fix possible NULL sk dereference in __skb_tstamp_tx

Test that sk != NULL before reading sk->sk_tsflags.

Fixes: 49ca0d8b ("net-timestamp: no-payload option")
Reported-by: default avatarOne Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c29390c6
...@@ -3733,9 +3733,13 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, ...@@ -3733,9 +3733,13 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb,
struct sock *sk, int tstype) struct sock *sk, int tstype)
{ {
struct sk_buff *skb; 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; return;
if (tsonly) if (tsonly)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment