[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <02874ECE860811409154E81DA85FBB589698F67E@ORSMSX121.amr.corp.intel.com>
Date: Thu, 14 Nov 2019 19:06:58 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Richard Cochran <richardcochran@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
David Miller <davem@...emloft.net>,
Brandon Streiff <brandon.streiff@...com>,
"Hall, Christopher S" <christopher.s.hall@...el.com>,
Eugenia Emantayev <eugenia@...lanox.com>,
Felipe Balbi <felipe.balbi@...ux.intel.com>,
"Feras Daoud" <ferasda@...lanox.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
Stefan Sorensen <stefan.sorensen@...ctralink.com>
Subject: RE: [PATCH net 01/13] ptp: Validate requests to enable time
stamping of external signals.
> -----Original Message-----
> From: Richard Cochran <richardcochran@...il.com>
> Sent: Thursday, November 14, 2019 10:45 AM
> To: netdev@...r.kernel.org
> Cc: intel-wired-lan@...ts.osuosl.org; David Miller <davem@...emloft.net>;
> Brandon Streiff <brandon.streiff@...com>; Hall, Christopher S
> <christopher.s.hall@...el.com>; Eugenia Emantayev <eugenia@...lanox.com>;
> Felipe Balbi <felipe.balbi@...ux.intel.com>; Feras Daoud
> <ferasda@...lanox.com>; Keller, Jacob E <jacob.e.keller@...el.com>; Kirsher,
> Jeffrey T <jeffrey.t.kirsher@...el.com>; Sergei Shtylyov
> <sergei.shtylyov@...entembedded.com>; Stefan Sorensen
> <stefan.sorensen@...ctralink.com>
> Subject: [PATCH net 01/13] ptp: Validate requests to enable time stamping of
> external signals.
>
> Commit 415606588c61 ("PTP: introduce new versions of IOCTLs")
> introduced a new external time stamp ioctl that validates the flags.
> This patch extends the validation to ensure that at least one rising
> or falling edge flag is set when enabling external time stamps.
>
> Signed-off-by: Richard Cochran <richardcochran@...il.com>
> ---
> drivers/ptp/ptp_chardev.c | 18 +++++++++++++-----
> include/uapi/linux/ptp_clock.h | 1 +
> 2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 67d0199840fd..cbbe1237ff8d 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -149,11 +149,19 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd,
> unsigned long arg)
> err = -EFAULT;
> break;
> }
> - if (((req.extts.flags & ~PTP_EXTTS_VALID_FLAGS) ||
> - req.extts.rsv[0] || req.extts.rsv[1]) &&
> - cmd == PTP_EXTTS_REQUEST2) {
> - err = -EINVAL;
> - break;
> + if (cmd == PTP_EXTTS_REQUEST2) {
> + /* Make sure no reserved bit is set. */
> + if ((req.extts.flags & ~PTP_EXTTS_VALID_FLAGS) ||
> + req.extts.rsv[0] || req.extts.rsv[1]) {
> + err = -EINVAL;
> + break;
> + }
> + /* Ensure one of the rising/falling edge bits is set. */
> + if ((req.extts.flags & PTP_ENABLE_FEATURE) &&
> + (req.extts.flags & PTP_EXTTS_EDGES) == 0) {
> + err = -EINVAL;
> + break;
> + }
Just to confirm, these new ioctls haven't been around long enough to be concerned about this change?
Thanks,
Jake
Powered by blists - more mailing lists