netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] packet: fix panic in __packet_set_timestamp on tpacket_v3 in tx mode
@ 2017-01-05  1:34 Daniel Borkmann
  2017-01-05  2:10 ` Sowmini Varadhan
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Daniel Borkmann @ 2017-01-05  1:34 UTC (permalink / raw)
  To: davem; +Cc: sowmini.varadhan, willemb, netdev, Daniel Borkmann

When TX timestamping is in use with TPACKET_V3's TX ring, then we'll
hit the BUG() in __packet_set_timestamp() when ring buffer slot is
returned to user space via tpacket_destruct_skb(). This is due to v3
being assumed as unreachable here, but since 7f953ab2ba46 ("af_packet:
TX_RING support for TPACKET_V3") it's not anymore. Fix it by filling
the timestamp back into the ring slot.

Fixes: 7f953ab2ba46 ("af_packet: TX_RING support for TPACKET_V3")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
 net/packet/af_packet.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 7e39087..ddbda25 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -481,6 +481,9 @@ static __u32 __packet_set_timestamp(struct packet_sock *po, void *frame,
 		h.h2->tp_nsec = ts.tv_nsec;
 		break;
 	case TPACKET_V3:
+		h.h3->tp_sec = ts.tv_sec;
+		h.h3->tp_nsec = ts.tv_nsec;
+		break;
 	default:
 		WARN(1, "TPACKET version not supported.\n");
 		BUG();
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-03-06 22:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-05  1:34 [PATCH net-next] packet: fix panic in __packet_set_timestamp on tpacket_v3 in tx mode Daniel Borkmann
2017-01-05  2:10 ` Sowmini Varadhan
2017-01-05  4:51 ` David Miller
2017-01-05 18:27 ` Eric Dumazet
2017-01-05 19:10   ` Daniel Borkmann
2017-03-06 17:13     ` chetan loke
2017-03-06 17:45       ` Willem de Bruijn
2017-03-06 21:36         ` chetan loke
2017-03-06 22:13           ` Willem de Bruijn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).