aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2016-11-01 10:45:52 -0400
committerDavid S. Miller <davem@davemloft.net>2016-11-01 12:13:13 -0400
commit22ca904ad70afc831d8503e80be1b6558a978759 (patch)
treeaa27f53e2b2eab9a82c4ab00b53e02430a3339c5 /net/netlink
parente58e415968110648231ed6783d38e78032661cee (diff)
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 <weiyongjun1@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/genetlink.c4
1 files changed, 3 insertions, 1 deletions
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)
362 362
363 family->id = idr_alloc(&genl_fam_idr, family, 363 family->id = idr_alloc(&genl_fam_idr, family,
364 start, end + 1, GFP_KERNEL); 364 start, end + 1, GFP_KERNEL);
365 if (!family->id) 365 if (family->id < 0) {
366 err = family->id;
366 goto errout_locked; 367 goto errout_locked;
368 }
367 369
368 err = genl_validate_assign_mc_groups(family); 370 err = genl_validate_assign_mc_groups(family);
369 if (err) 371 if (err)