From: Jacob Keller <jacob.e.keller@intel.com>
To: netdev@vger.kernel.org
Cc: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>,
Jeffrey Kirsher <jeffrey.t.kirsher@intel.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Richard Cochran <richardcochran@gmail.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
"David S . Miller" <davem@davemloft.net>,
Christopher Hall <christopher.s.hall@intel.com>
Subject: [net-next v2 0/2] new PTP ioctl fixes
Date: Wed, 25 Sep 2019 19:28:18 -0700 [thread overview]
Message-ID: <20190926022820.7900-1-jacob.e.keller@intel.com> (raw)
I noticed recently that Filip added new versions of the PTP ioctls which
correctly honor the reserved fields (making it so that we can safely extend
them in the future).
Unfortunately, this breaks the old ioctls for a couple of reasons. First,
the flags for the old ioctls get cleared. This means that the external
timestamp request can never be enabled. Further, it means future new flags
will *not* be cleared, and thus old ioctl will potentially send non-zero
data and be mis-interpreted.
Additionally, new flags are not protected against in-driver, because no
current driver verifies that the flags are only one of the supported ones.
This means new flags will be mis-interpreted by the drivers.
This series provides patches to fix drivers to verify and reject unsupported
flags, as well as to fix the ioctls to clear flags on the old version of the
ioctl properly.
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Christopher Hall <christopher.s.hall@intel.com>
Range-diff from v1:
1: c317dc1cc7eb = 1: c317dc1cc7eb ptp: correctly disable flags on old ioctls
2: 08ce725c7f2a ! 2: 5537762fb9cc net: reject ptp requests with unsupported flags
@@ drivers/net/phy/dp83640.c: static int ptp_dp83640_enable(struct ptp_clock_info *
switch (rq->type) {
case PTP_CLK_REQ_EXTTS:
+ /* Reject requests with unsupported flags */
-+ if (rq->extts.flags & ~(PTP_FEATURE_ENABLE |
++ if (rq->extts.flags & ~(PTP_ENABLE_FEATURE |
+ PTP_RISING_EDGE |
+ PTP_FALLING_EDGE))
+ return -EOPNOTSUPP;
Jacob Keller (2):
ptp: correctly disable flags on old ioctls
net: reject ptp requests with unsupported flags
drivers/net/dsa/mv88e6xxx/ptp.c | 5 +++++
drivers/net/ethernet/broadcom/tg3.c | 4 ++++
drivers/net/ethernet/intel/igb/igb_ptp.c | 8 +++++++
.../ethernet/mellanox/mlx5/core/lib/clock.c | 10 +++++++++
drivers/net/ethernet/microchip/lan743x_ptp.c | 4 ++++
drivers/net/ethernet/renesas/ravb_ptp.c | 9 ++++++++
.../net/ethernet/stmicro/stmmac/stmmac_ptp.c | 4 ++++
drivers/net/phy/dp83640.c | 8 +++++++
drivers/ptp/ptp_chardev.c | 4 ++--
include/uapi/linux/ptp_clock.h | 22 +++++++++++++++++++
10 files changed, 76 insertions(+), 2 deletions(-)
--
2.23.0.245.gf157bbb9169d
next reply other threads:[~2019-09-26 2:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-26 2:28 Jacob Keller [this message]
2019-09-26 2:28 ` [net-next v2 1/2] ptp: correctly disable flags on old ioctls Jacob Keller
2019-09-26 3:43 ` Richard Cochran
2019-09-27 18:25 ` David Miller
2019-09-26 2:28 ` [net-next v2 2/2] net: reject ptp requests with unsupported flags Jacob Keller
2019-09-26 4:02 ` Richard Cochran
2019-09-26 17:41 ` Keller, Jacob E
2019-09-26 17:42 ` Keller, Jacob E
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190926022820.7900-1-jacob.e.keller@intel.com \
--to=jacob.e.keller@intel.com \
--cc=christopher.s.hall@intel.com \
--cc=davem@davemloft.net \
--cc=felipe.balbi@linux.intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).