lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Jul 2020 23:38:13 +0300
From:   Sergey Organov <sorganov@...il.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Fugang Duan <fugang.duan@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Richard Cochran <richardcochran@...il.com>,
        Vladimir Oltean <olteanv@...il.com>
Subject: Re: [PATCH v3 net] net: fec: fix hardware time stamping by external
 devices

Jakub Kicinski <kuba@...nel.org> writes:

> On Tue, 14 Jul 2020 19:28:02 +0300 Sergey Organov wrote:
>> Fix support for external PTP-aware devices such as DSA or PTP PHY:
>>
>> Make sure we never time stamp tx packets when hardware time stamping
>> is disabled.
>>
>> Check for PTP PHY being in use and then pass ioctls related to time
>> stamping of Ethernet packets to the PTP PHY rather than handle them
>> ourselves. In addition, disable our own hardware time stamping in this
>> case.
>>
>> Fixes: 6605b730c061 ("FEC: Add time stamping code and a PTP hardware
>> clock")
>> Signed-off-by: Sergey Organov <sorganov@...il.com>
>> Acked-by: Richard Cochran <richardcochran@...il.com>
>> Acked-by: Vladimir Oltean <olteanv@...il.com>
>> ---
>>
>> v3:
>>   - Fixed SHA1 length of Fixes: tag
>>   - Added Acked-by: tags
>>
>> v2:
>>   - Extracted from larger patch series
>>   - Description/comments updated according to discussions
>>   - Added Fixes: tag
>
> FWIW in the networking subsystem we like the changelog to be part of the
> commit.

Thanks, Jakub, I took a notice for myself!

>
> Applied, and added to the stable queue, thanks!

Thanks, and I've also got a no-brainer patch that lets this bug fix
compile as-is with older kernels, where there were no phy_has_hwtstamp()
function. Dunno how to properly handle this. Here is the patch (on
top of v4.9.146), just in case:

--- >8 ---

commit eee1f92bbc83ad59c83935a21f635e088cf7aa02
Author: Sergey Organov <sorganov@...il.com>
Date:   Tue Jun 30 17:12:16 2020 +0300

    phy: add phy_has_hwtstamp() for compatibility with newer kernels

    Signed-off-by: Sergey Organov <sorganov@...il.com>

diff --git a/include/linux/phy.h b/include/linux/phy.h
index 867110c9d707..aa01ed4e8e1f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -595,6 +595,15 @@ struct phy_driver {
 #define PHY_ANY_ID "MATCH ANY PHY"
 #define PHY_ANY_UID 0xffffffff
 
+/**
+ * phy_has_hwtstamp - Tests whether a PHY supports time stamp configuration.
+ * @phydev: the phy_device struct
+ */
+static inline bool phy_has_hwtstamp(struct phy_device *phydev)
+{
+       return phydev && phydev->drv && phydev->drv->hwtstamp;
+}
+
 /* A Structure for boards to register fixups with the PHY Lib */
 struct phy_fixup {
        struct list_head list;


-- Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ