diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index caf04d70ba71..bbd3bff885a1 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -362,8 +362,10 @@ int genl_register_family(struct genl_family *family) family->id = idr_alloc(&genl_fam_idr, family, start, end + 1, GFP_KERNEL); - if (!family->id) + if (family->id < 0) { + err = family->id; goto errout_locked; + } err = genl_validate_assign_mc_groups(family); if (err)