From 608bb146ff48588c43bf6332912ea8796768fb39 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Wed, 3 Jun 2015 16:30:59 -0700 Subject: [PATCH] fm10k: use correct ethernet driver Tx timestamp function skb_complete_tx_timestamp is intended for use by PHY drivers which implement a different method of returning timestamps. This method is intended to be used after a PHY driver accepts a cloned packet via its phy_driver.txtstamp function. It is not correct to use in the standard ethernet driver such as fm10k. This patch fixes the following possible kernel panic. [ 2744.552896] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W OE 3.19.3-200.fc21.x86_64 #1 [ 2744.552899] Hardware name: Intel Corporation S2600CO/S2600CO, BIOS SE5C600.86B.02.03.8x23.060520140825 06/05/2014 [ 2744.552901] 0000000000000000 2f4c8b10ea3f9848 ffff88081ee03a38 ffffffff8176e215 [ 2744.552906] 0000000000000000 0000000000000000 ffff88081ee03a78 ffffffff8109bc1a [ 2744.552910] ffff88081ee03c50 ffff88080e55fc00 ffff88080e55fc00 ffffffff81647c50 [ 2744.552914] Call Trace: [ 2744.552917] [] dump_stack+0x45/0x57 [ 2744.552931] [] warn_slowpath_common+0x8a/0xc0 [ 2744.552936] [] ? skb_queue_purge+0x20/0x40 [ 2744.552941] [] warn_slowpath_null+0x1a/0x20 [ 2744.552946] [] skb_release_head_state+0xe1/0xf0 [ 2744.552950] [] skb_release_all+0x16/0x30 [ 2744.552954] [] kfree_skb+0x36/0x90 [ 2744.552958] [] skb_queue_purge+0x20/0x40 [ 2744.552964] [] packet_sock_destruct+0x1d/0x90 [ 2744.552968] [] __sk_free+0x23/0x140 [ 2744.552973] [] sk_free+0x19/0x20 [ 2744.552977] [] skb_complete_tx_timestamp+0x50/0x60 [ 2744.552988] [] fm10k_ts_tx_hwtstamp+0xd0/0x100 [fm10k] [ 2744.552994] [] fm10k_1588_msg_pf+0x12e/0x140 [fm10k] [ 2744.553002] [] fm10k_tlv_msg_parse+0x8d/0xc0 [fm10k] [ 2744.553010] [] fm10k_mbx_dequeue_rx+0x60/0xb0 [fm10k] [ 2744.553016] [] fm10k_sm_mbx_process+0x178/0x3c0 [fm10k] [ 2744.553022] [] fm10k_msix_mbx_pf+0xfa/0x360 [fm10k] [ 2744.553030] [] ? get_next_timer_interrupt+0x1f7/0x270 [ 2744.553036] [] handle_irq_event_percpu+0x77/0x1a0 [ 2744.553041] [] handle_irq_event+0x3b/0x60 [ 2744.553045] [] handle_edge_irq+0x6e/0x120 [ 2744.553054] [] handle_irq+0x74/0x140 [ 2744.553061] [] ? atomic_notifier_call_chain+0x1a/0x20 [ 2744.553066] [] do_IRQ+0x4f/0xf0 [ 2744.553072] [] common_interrupt+0x6d/0x6d [ 2744.553074] [] ? cpuidle_enter_state+0x66/0x160 [ 2744.553084] [] ? cpuidle_enter_state+0x51/0x160 [ 2744.553087] [] cpuidle_enter+0x17/0x20 [ 2744.553092] [] cpu_startup_entry+0x321/0x3c0 [ 2744.553098] [] rest_init+0x77/0x80 [ 2744.553103] [] start_kernel+0x4a4/0x4c5 [ 2744.553107] [] ? early_idt_handlers+0x120/0x120 [ 2744.553110] [] x86_64_start_reservations+0x2a/0x2c [ 2744.553114] [] x86_64_start_kernel+0x152/0x175 Signed-off-by: Jacob Keller Tested-by: Krishneil Singh Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/fm10k/fm10k_ptp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c b/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c index 9043633c3e50..95f1d62b0690 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c @@ -103,9 +103,10 @@ void fm10k_ts_tx_hwtstamp(struct fm10k_intfc *interface, __le16 dglort, if (!skb) return; - /* timestamp the sk_buff and return it to the socket */ + /* timestamp the sk_buff and free out copy */ fm10k_systime_to_hwtstamp(interface, &shhwtstamps, systime); - skb_complete_tx_timestamp(skb, &shhwtstamps); + skb_tstamp_tx(skb, &shhwtstamps); + dev_kfree_skb_any(skb); } void fm10k_ts_tx_subtask(struct fm10k_intfc *interface) -- 2.20.1