From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6663DC2D0CE for ; Sun, 29 Dec 2019 17:40:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 383CC206DB for ; Sun, 29 Dec 2019 17:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641208; bh=iuZex+/UIPx6YMKd25QOa2RjDFKuJLrKMSXeBucmcPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LZVmuJ6kYFIUO0XvzhgKxtlVmn54KDyiAadm276N8qR6+AdPIv0XDcH3qerpwSC0q DOehmD5eNqj9S8icnfTWpIUcFDR7IvMYE1ndNHPh/ZmLEyvLGRA6AqsFw59AkFxaXG 6s+j74qvJcxLqv+ICNqERgbGyLX7sbLJhiexGItI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729275AbfL2RcN (ORCPT ); Sun, 29 Dec 2019 12:32:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:60400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729264AbfL2RcJ (ORCPT ); Sun, 29 Dec 2019 12:32:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 10B7C207FF; Sun, 29 Dec 2019 17:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640728; bh=iuZex+/UIPx6YMKd25QOa2RjDFKuJLrKMSXeBucmcPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTt0yQt1Xp2Plw8zc0tpwQnOblW8icSNmthAqkFY/q/SPVj0OL/MXeFG/fMaKi3xR gyptUmykFlGlNPFTJ1E1E65YP51xzN7fm+bGM30VHtM6JTt8zTzNVl3ufWnWk5juuB QTbDKJsUCAFab+Krb67F92u+G4JSVIdiohjUkBKM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manjunath Patil , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.19 114/219] ixgbe: protect TX timestamping from API misuse Date: Sun, 29 Dec 2019 18:18:36 +0100 Message-Id: <20191229162525.950606964@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Manjunath Patil [ Upstream commit 07066d9dc3d2326fbad8f7b0cb0120cff7b7dedb ] HW timestamping can only be requested for a packet if the NIC is first setup via ioctl(SIOCSHWTSTAMP). If this step was skipped, then the ixgbe driver still allowed TX packets to request HW timestamping. In this situation, we see 'clearing Tx Timestamp hang' noise in the log. Fix this by checking that the NIC is configured for HW TX timestamping before accepting a HW TX timestamping request. Similar-to: commit 26bd4e2db06b ("igb: protect TX timestamping from API misuse") commit 0a6f2f05a2f5 ("igb: Fix a test with HWTSTAMP_TX_ON") Signed-off-by: Manjunath Patil Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index b45a6e2ed8d1..de65ca1e6558 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -8551,7 +8551,8 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && adapter->ptp_clock) { - if (!test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS, + if (adapter->tstamp_config.tx_type == HWTSTAMP_TX_ON && + !test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state)) { skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; tx_flags |= IXGBE_TX_FLAGS_TSTAMP; -- 2.20.1