backports: genl: fix family->family.id access
authorJohannes Berg <johannes.berg@intel.com>
Mon, 25 Jun 2018 16:37:56 +0000 (18:37 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 25 Jun 2018 16:37:56 +0000 (18:37 +0200)
If compiling on 3.13, struct genl_family isn't actually
struct backport_genl_family, and then family->family
doesn't exist. In other cases, it's actually necessary
to update it, so add an #ifdef with the same logic as
the override from genl_family -> backport_genl_family.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
backport/compat/backport-4.12.c

index 4948b531daabeb5987b77f09816926c748e4fb10..5fc8c10cb8d807f8efabf1c3e64ea862b9b9876b 100644 (file)
@@ -226,11 +226,13 @@ int bp_extack_genl_register_family(struct genl_family *family)
        family->id = copy->family.id;
        family->attrbuf = copy->family.attrbuf;
 
+#if LINUX_VERSION_IS_LESS(3,13,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)
        /* family ID from the original family struct will be used when building
         * genl messages (sent as nlmsg_type), so the new id should be updated
         * in the original (older kernel format) family struct too
         */
        family->family.id = copy->family.id;
+#endif
 
 #if LINUX_VERSION_IS_GEQ(3,13,0)
        family->mcgrp_offset = copy->family.mcgrp_offset;