Skip to content

Commit

Permalink
broadcom: fix supported flag check in periodic output function
Browse files Browse the repository at this point in the history
In bcm_ptp_perout_locked, the driver rejects requests which have
PTP_PEROUT_PHASE set. This appears to be an attempt to reject any
unsupported flags. Unfortunately, this only checks one flag, but does not
protect against PTP_PEROUT_ONE_SHOT, or any future flags which may be
added.

Fix the check to ensure that no flag other than the supported
PTP_PEROUT_DUTY_CYCLE is set.

Fixes: 7bfe91e ("net: phy: Add support for 1PPS out and external timestamps")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250312-jk-net-fixes-supported-extts-flags-v2-4-ea930ba82459@intel.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Jacob Keller authored and Paolo Abeni committed Mar 20, 2025
1 parent c0b4ddd commit af2b428
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/phy/bcm-phy-ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ static int bcm_ptp_perout_locked(struct bcm_ptp_private *priv,

period = BCM_MAX_PERIOD_8NS; /* write nonzero value */

if (req->flags & PTP_PEROUT_PHASE)
/* Reject unsupported flags */
if (req->flags & ~PTP_PEROUT_DUTY_CYCLE)
return -EOPNOTSUPP;

if (req->flags & PTP_PEROUT_DUTY_CYCLE)
Expand Down

0 comments on commit af2b428

Please sign in to comment.