diff options
author | Jacob Keller <jacob.e.keller@intel.com> | 2019-09-25 19:28:19 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-27 20:25:32 +0200 |
commit | 2df4de1681767df900e15e34195bbf7dc1b23e06 (patch) | |
tree | 1ded2106e3e0ff1cf96b4ec30b43b17a8516ea9f /net/bridge/br_forward.c | |
parent | 991ad2b24da2fa7b4ba9775ca1fed2d660d54ab0 (diff) | |
download | linux-2df4de1681767df900e15e34195bbf7dc1b23e06.tar.bz2 |
ptp: correctly disable flags on old ioctls
Commit 415606588c61 ("PTP: introduce new versions of IOCTLs",
2019-09-13) introduced new versions of the PTP ioctls which actually
validate that the flags are acceptable values.
As part of this, it cleared the flags value using a bitwise
and+negation, in an attempt to prevent the old ioctl from accidentally
enabling new features.
This is incorrect for a couple of reasons. First, it results in
accidentally preventing previously working flags on the request ioctl.
By clearing the "valid" flags, we now no longer allow setting the
enable, rising edge, or falling edge flags.
Second, if we add new additional flags in the future, they must not be
set by the old ioctl. (Since the flag wasn't checked before, we could
potentially break userspace programs which sent garbage flag data.
The correct way to resolve this is to check for and clear all but the
originally valid flags.
Create defines indicating which flags are correctly checked and
interpreted by the original ioctls. Use these to clear any bits which
will not be correctly interpreted by the original ioctls.
In the future, new flags must be added to the VALID_FLAGS macros, but
*not* to the V1_VALID_FLAGS macros. In this way, new features may be
exposed over the v2 ioctls, but without breaking previous userspace
which happened to not clear the flags value properly. The old ioctl will
continue to behave the same way, while the new ioctl gains the benefit
of using the flags fields.
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Christopher Hall <christopher.s.hall@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_forward.c')
0 files changed, 0 insertions, 0 deletions