diff options
author | Jakub Kicinski <kuba@kernel.org> | 2022-10-25 17:15:24 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-10-27 08:20:21 -0700 |
commit | ce48ebdd56513fa5ad9dab683a96399e00dbf464 (patch) | |
tree | b7d71f1caa4b4ea858254485ff5918b10ce1cefd /net/netlink | |
parent | 9f172134dde7e4f5bf4b9139f23a1e741ec1c36e (diff) |
genetlink: limit the use of validation workarounds to old ops
During review of previous change another thing came up - we should
limit the use of validation workarounds to old commands.
Don't list the workarounds one by one, as we're rejecting all existing
ones. We can deal with the masking in the unlikely event that new flag
is added.
Link: https://lore.kernel.org/all/6ba9f727e555fd376623a298d5d305ad408c3d47.camel@sipsolutions.net/
Link: https://lore.kernel.org/r/20221026001524.1892202-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/genetlink.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index b1fd059c9992..3e16527beb91 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -380,6 +380,8 @@ static int genl_validate_ops(const struct genl_family *family) genl_get_cmd_by_index(i, family, &op); if (op.dumpit == NULL && op.doit == NULL) return -EINVAL; + if (WARN_ON(op.cmd >= family->resv_start_op && op.validate)) + return -EINVAL; for (j = i + 1; j < genl_get_cmd_cnt(family); j++) { struct genl_ops op2; |