Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13370799ybl; Sun, 29 Dec 2019 10:16:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzCRYM3nUqikXkPEdPYsoqhj9Yeuxeuy2IAxv3TD/cAX1Q9EWMn/xW/CHFa+nyZUmh5DlAx X-Received: by 2002:a9d:461b:: with SMTP id y27mr75825170ote.280.1577643406285; Sun, 29 Dec 2019 10:16:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577643406; cv=none; d=google.com; s=arc-20160816; b=BYuLyOfU2XmSaxL8/C8ihNHhvTD3RByoDJKPKa7qjkf1CQ8O98YcmEFcU6f4LmwfVo kW+LwOXYzUL2eI2Td8FpYPfX8iSofpHudIIy3douFGteZ9YwXwSZz+gPmTr3q8AEVUrA NVpippbiWxIXfIeAtGwizjqxmObjlPtcDPXWUhwRHLkreEIf7dqalJZg4FMVy9BjoD/l bBmCYegD7fBtBb79T0YVjiH/uGnvPbP7KDxhJGgFBy1gLSdsU9XDYqZxiuWrjLnIHP5U g4PmUWrC5K6NohV2bNtLbg8Enzzaikgfo1LTwepQEdYxB3CKYuYCt/fR0tGEB9N/ZsvE VwWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9IFSNz9C3QOo3Yh+wrPXp77Ww2HufTiAUovPVHAjf24=; b=mno1lBmTYeD7TDv5KiMr9qUfoJhYGwKFYCHZIGqPhTyZ93f+Mhhq03e1Ycdj8S08Cz kKGQn6Pol3Bmgy5QUIV4g2p8wg+8nFPHIRqNCSJvMrppeDox6KEGsyp5hGmGcQAsOE3n D59rzm6dviPiw8vfQrRP28lx+EgkuU8qr+yrhB4bwl7qmyrZI9W/ZVeOW4IFUpYM2lln sGeXb5/mpC9owX9IpNRZ1jNxUuPKVzaqzpdCNbQOwBsn1+HXBB4Ge2Zkuc9iK3vzcqsy GNfw078mZbJSjaMOgmN3/HMh9rx4LV8t7fTJlKIUfCJx631YDwz6VHpn2upmgE7nqwYD XOpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nxwvsKVO; 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 w23si17869018otp.109.2019.12.29.10.16.35; Sun, 29 Dec 2019 10:16:46 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=nxwvsKVO; 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 S1730412AbfL2SPO (ORCPT + 99 others); Sun, 29 Dec 2019 13:15:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:46202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728071AbfL2RZw (ORCPT ); Sun, 29 Dec 2019 12:25:52 -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 1F262222C4; Sun, 29 Dec 2019 17:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640351; bh=jUav1XY2M0fVrUY8q5d77WNolTAeTgi8EvgTzW6dYrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nxwvsKVOQL8PjmY8a8O2/9nQb7/IPP1KjcEnIkiqmSR+uGKVfaDhpEtP219m1qc1O 5A+iNMb03tWRiZn/Q3nQ8jYpZM/e3s3xqjcqXkdejDpgWO+qmoqjSZTEDK+Q8VQTjR 9WHzMWKT/RKArawsCU/p7ZpPbFx5EiKkqns3qwRI= 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.14 084/161] ixgbe: protect TX timestamping from API misuse Date: Sun, 29 Dec 2019 18:18:52 +0100 Message-Id: <20191229162424.608628789@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@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 4801d96c4fa9..0edfd199937d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -8379,7 +8379,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