Skip to content

Commit

Permalink
genetlink: don't merge dumpit split op for different cmds into single…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Jiri Pirko authored and Jakub Kicinski committed Oct 23, 2023
1 parent b7c4f57 commit f862ed2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down

0 comments on commit f862ed2

Please sign in to comment.