Commit 22ca904a authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

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: 2ae0f17d ("genetlink: use idr to track families")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e58e4159
...@@ -362,8 +362,10 @@ int genl_register_family(struct genl_family *family) ...@@ -362,8 +362,10 @@ int genl_register_family(struct genl_family *family)
family->id = idr_alloc(&genl_fam_idr, family, family->id = idr_alloc(&genl_fam_idr, family,
start, end + 1, GFP_KERNEL); start, end + 1, GFP_KERNEL);
if (!family->id) if (family->id < 0) {
err = family->id;
goto errout_locked; goto errout_locked;
}
err = genl_validate_assign_mc_groups(family); err = genl_validate_assign_mc_groups(family);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment