]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
genetlink: don't merge dumpit split op for different cmds into single iter
authorJiri Pirko <jiri@nvidia.com>
Sat, 21 Oct 2023 11:27:02 +0000 (13:27 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 23 Oct 2023 23:11:53 +0000 (16:11 -0700)
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>
net/netlink/genetlink.c

index 8315d31b53db425c4d1ff1ae7b3c8b0e099da6d6..92ef5ed2e7b0422e389d1a9c5696c6e2323a7450 100644 (file)
@@ -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++;