Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1113032imm; Wed, 1 Aug 2018 10:23:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmFJVGIT0XOFqLHDpcEVqig+PuTU/rJXZOR5ObmkL/xCkgTsIocBofqXJVjLGDV3/tGa03 X-Received: by 2002:a62:225d:: with SMTP id i90-v6mr27410792pfi.246.1533144211046; Wed, 01 Aug 2018 10:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144211; cv=none; d=google.com; s=arc-20160816; b=aTdWrQygOZdu8XnUwBz/wM+Ajag3Pm1uhv+qy8wn7vM4s5b3VswXAXiD8HH5n9yAF6 6IMtTlyeksnxFoUKI2Re9BcZPnqKcaRnRMoUU6Fqg/uNN10xwenPf9pywpHnLdx1Q+TF UQMP/dHELetDbeL99R4lfgpC6SHv6CnMFZbS+d2wns3BIE41BQM72FKN47yunQSuutKP jdHAFyV81yZMkfD2gfEPrdLGzKxj5B3oPpXmF1Sex0JRMuK5yno4tYhgVA5a+OyH3hFY drEksCX+YQTvOLxbI1eUpI82jGVQudzjNyOGAd71BwuUQEPwTsz4HcPqHTSMvYELV0ng 3DKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=wU85aA0hOMJjkujjxKrqXsmXbPvMgfJ6XvvfjJ6VLSs=; b=JTuRoITlRqjFm3l5qxTSmMU9QPUjScq+QTAoLd4naJtHFnXur/KXxqubnJ/9+VLPmg 5ohp6aU0hoxe24fFwNJkHZwrwfWCmCsJMDIN8ixnLH3fnKSwPOPPqUNy4hZyYpDgx8zv 5BThH2zIYG6Z5Wh3x/o9XCMjFOl5nOj+zP652tloIUb1DFjdiIHFcRH+8RfJQ9uxqjLM sKiXQND1l/2efuDN9rKoyyuJR2GOgsjoSsXXKRohHy5ZB5llcZmf6Ue22Fr5PCc5He+6 n/zVDs2LuVp8kRxpDFE3s8wLeDUDb88S+GdKLHhVKJQT5hzGGZyGRk6fX6FVo+XyaPod 880g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p67-v6si17020029pfg.295.2018.08.01.10.23.16; Wed, 01 Aug 2018 10:23:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405594AbeHATIQ (ORCPT + 99 others); Wed, 1 Aug 2018 15:08:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49380 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389715AbeHATIP (ORCPT ); Wed, 1 Aug 2018 15:08:15 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 30758CF7; Wed, 1 Aug 2018 17:21:34 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacob Keller , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.14 146/246] i40e: free the skb after clearing the bitlock Date: Wed, 1 Aug 2018 18:50:56 +0200 Message-Id: <20180801165018.713618880@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacob Keller [ Upstream commit c79756cb5f084736b138da9319a02f7c72644548 ] In commit bbc4e7d273b5 ("i40e: fix race condition with PTP_TX_IN_PROGRESS bits") we modified the code which handles Tx timestamps so that we would clear the progress bit as soon as possible. A later commit 0bc0706b46cd ("i40e: check for Tx timestamp timeouts during watchdog") introduced similar code for detecting and handling cleanup of a blocked Tx timestamp. This code did not use the same pattern for cleaning up the skb. Update this code to wait to free the skb until after the bit lock is free, by first setting the ptp_tx_skb to NULL and clearing the lock. Signed-off-by: Jacob Keller Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c @@ -337,6 +337,8 @@ void i40e_ptp_rx_hang(struct i40e_pf *pf **/ void i40e_ptp_tx_hang(struct i40e_pf *pf) { + struct sk_buff *skb; + if (!(pf->flags & I40E_FLAG_PTP) || !pf->ptp_tx) return; @@ -349,9 +351,12 @@ void i40e_ptp_tx_hang(struct i40e_pf *pf * within a second it is reasonable to assume that we never will. */ if (time_is_before_jiffies(pf->ptp_tx_start + HZ)) { - dev_kfree_skb_any(pf->ptp_tx_skb); + skb = pf->ptp_tx_skb; pf->ptp_tx_skb = NULL; clear_bit_unlock(__I40E_PTP_TX_IN_PROGRESS, pf->state); + + /* Free the skb after we clear the bitlock */ + dev_kfree_skb_any(skb); pf->tx_hwtstamp_timeouts++; } }