RE: [PATCH net-next v3 2/3] ptp: Add file permission checks on PHCs
From: Wojtek Wasko <hidden>
Date: 2025-02-19 09:45:41
On Mon, Feb 17 2025 at 21:24, Thomas Gleixner wrote:
quoted
One limitation remains: querying the adjusted frequency of a PTP device (using adjtime() with an empty modes field) is not supported for chardevs opened without WRITE permissions, as the POSIX layer mandates WRITE access for any adjtime operation.That's a fixable problem, no?
Absolutely, but to be honest I wasn't sure about how to properly change
the access check in adjtime given it's a "generic" API. I ended up with
something along the lines of:
if (tx->modes & ~(ADJ_NANO | ADJ_MICRO))
/* require WRITE */
being that ADJ_NANO and ADJ_MICRO by themselves don't mean the clock will
be modified. So the modes field is not really "empty" per se and the check
becomes less self-explanatory.
But then maybe I'm overthinking it. If you think the above modes check is
the right way to go, I'll send a v4 (using the opportunity to add the
Reviewed-By and Acked-By tags from v2 I missed in v3 - I'm new to kernel
development, sorry).
Thanks,
W