diff options
author | Jiri Pirko <jiri@nvidia.com> | 2023-10-21 13:27:02 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-10-23 16:11:53 -0700 |
commit | f862ed2d0bf0cf51c28c1a69e3c2a1558d5a2978 (patch) | |
tree | d406a76cacb5a204516cc2f0577156289957a55b /net | |
parent | b7c4f5730a9fa258c8e79f6387a03f3a95c681a2 (diff) |
genetlink: don't merge dumpit split op for different cmds into single iter
Currently, split ops of doit and dumpit are merged into a single iter
item when they are subsequent. However, there is no guarantee that the
dumpit op is for the same cmd as doit op.
Fix this by checking if cmd is the same for both.
This problem does not occur in existing families.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20231021112711.660606-2-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netlink/genetlink.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 8315d31b53db..92ef5ed2e7b0 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -225,7 +225,8 @@ static void genl_op_from_split(struct genl_op_iter *iter) } if (i + cnt < family->n_split_ops && - family->split_ops[i + cnt].flags & GENL_CMD_CAP_DUMP) { + family->split_ops[i + cnt].flags & GENL_CMD_CAP_DUMP && + (!cnt || family->split_ops[i + cnt].cmd == iter->doit.cmd)) { iter->dumpit = family->split_ops[i + cnt]; genl_op_fill_in_reject_policy_split(family, &iter->dumpit); cnt++; |