From: Wei Yongjun Date: Tue, 1 Nov 2016 14:45:52 +0000 (+0000) Subject: genetlink: fix error return code in genl_register_family() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=22ca904ad70a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git genetlink: fix error return code in genl_register_family() Fix to return a negative error code from the idr_alloc() error handling case instead of 0, as done elsewhere in this function. Also fix the return value check of idr_alloc() since idr_alloc return negative errors on failure, not zero. Fixes: 2ae0f17df1cd ("genetlink: use idr to track families") Signed-off-by: Wei Yongjun Signed-off-by: David S. Miller --- 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)