[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1426103035-24748-1-git-send-email-willemb@google.com>
Date: Wed, 11 Mar 2015 15:43:55 -0400
From: Willem de Bruijn <willemb@...gle.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, gnomes@...rguk.ukuu.org.uk,
Willem de Bruijn <willemb@...gle.com>
Subject: [PATCH net] sock: fix possible NULL sk dereference in __skb_tstamp_tx
From: Willem de Bruijn <willemb@...gle.com>
Test that sk != NULL before reading sk->sk_tsflags.
Fixes: 49ca0d8bfaf3 ("net-timestamp: no-payload option")
Reported-by: One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
Signed-off-by: Willem de Bruijn <willemb@...gle.com>
---
net/core/skbuff.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 47c3241..5bffca7 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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)
--
2.2.0.rc0.207.ga3a616c
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists