Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+2
+2
net/netlink/genetlink.c
··· 380 380 genl_get_cmd_by_index(i, family, &op); 381 381 if (op.dumpit == NULL && op.doit == NULL) 382 382 return -EINVAL; 383 + if (WARN_ON(op.cmd >= family->resv_start_op && op.validate)) 384 + return -EINVAL; 383 385 for (j = i + 1; j < genl_get_cmd_cnt(family); j++) { 384 386 struct genl_ops op2; 385 387