Skip to content

Commit e8e9c98

Browse files
jacob-kellerdavem330
authored andcommitted
dp83640: reject unsupported external timestamp flags
Fix the dp83640 PTP support to explicitly reject any future flags that get added to the external timestamp request ioctl. In order to maintain currently functioning code, this patch accepts all three current flags. This is because the PTP_RISING_EDGE and PTP_FALLING_EDGE flags have unclear semantics and each driver seems to have interpreted them slightly differently. For the record, the semantics of this driver are: flags Meaning ---------------------------------------------------- -------------------------- PTP_ENABLE_FEATURE Time stamp rising edge PTP_ENABLE_FEATURE|PTP_RISING_EDGE Time stamp rising edge PTP_ENABLE_FEATURE|PTP_FALLING_EDGE Time stamp falling edge PTP_ENABLE_FEATURE|PTP_RISING_EDGE|PTP_FALLING_EDGE Time stamp falling edge Cc: Stefan Sørensen <[email protected]> Cc: Richard Cochran <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Reviewed-by: Richard Cochran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7d9465e commit e8e9c98

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/phy/dp83640.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,11 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
469469

470470
switch (rq->type) {
471471
case PTP_CLK_REQ_EXTTS:
472+
/* Reject requests with unsupported flags */
473+
if (rq->extts.flags & ~(PTP_ENABLE_FEATURE |
474+
PTP_RISING_EDGE |
475+
PTP_FALLING_EDGE))
476+
return -EOPNOTSUPP;
472477
index = rq->extts.index;
473478
if (index >= N_EXT_TS)
474479
return -EINVAL;

0 commit comments

Comments
 (0)