compat: fix a crash in the netlink backport
authorFelix Fietkau <nbd@openwrt.org>
Mon, 11 Oct 2010 17:41:45 +0000 (10:41 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Mon, 11 Oct 2010 17:41:45 +0000 (10:41 -0700)
Do not set the .doit wrapper if there is no .doit function.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
compat/compat-2.6.37.c

index 52c5a32..d949a92 100644 (file)
@@ -130,7 +130,8 @@ int compat_genl_register_family_with_ops(struct genl_family *family,
                __copy(dumpit);
                __copy(done);
 #undef __copy
-               ops[i].ops.doit = nl_doit_wrapper;
+               if (ops[i].doit)
+                       ops[i].ops.doit = nl_doit_wrapper;
                ret = genl_register_ops(&family->family, &ops[i].ops);
                if (ret < 0)
                        goto error_ops;