From: Richard Cochran Date: Thu, 14 Nov 2019 18:45:04 +0000 (-0800) Subject: dp83640: Reject requests to enable time stamping on both edges. X-Git-Tag: v5.4-rc8~8^2~9^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9289252bd1e6a37f8182f7c48e69927292fe9340;p=platform%2Fkernel%2Flinux-rpi.git dp83640: Reject requests to enable time stamping on both edges. This driver enables rising edge or falling edge, but not both, and so this patch validates that the request contains only one of the two edges. Signed-off-by: Richard Cochran Signed-off-by: David S. Miller --- diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 3bba2be..8f241b5 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -475,6 +475,13 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, PTP_FALLING_EDGE | PTP_STRICT_FLAGS)) return -EOPNOTSUPP; + + /* Reject requests to enable time stamping on both edges. */ + if ((rq->extts.flags & PTP_STRICT_FLAGS) && + (rq->extts.flags & PTP_ENABLE_FEATURE) && + (rq->extts.flags & PTP_EXTTS_EDGES) == PTP_EXTTS_EDGES) + return -EOPNOTSUPP; + index = rq->extts.index; if (index >= N_EXT_TS) return -EINVAL;