提交 dc97a1a9 编写于 作者: D David S. Miller

genetlink: A genl_bind() to an out-of-range multicast group should not WARN().

Users can request to bind to arbitrary multicast groups, so warning
when the requested group number is out of range is not appropriate.

And with the warning removed, and the 'err' variable properly given
an initial value, we can remove 'found' altogether.
Reported-by: NSedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 023e2cfa
...@@ -985,8 +985,7 @@ static struct genl_multicast_group genl_ctrl_groups[] = { ...@@ -985,8 +985,7 @@ static struct genl_multicast_group genl_ctrl_groups[] = {
static int genl_bind(struct net *net, int group) static int genl_bind(struct net *net, int group)
{ {
int i, err; int i, err = 0;
bool found = false;
down_read(&cb_lock); down_read(&cb_lock);
for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
...@@ -1003,16 +1002,12 @@ static int genl_bind(struct net *net, int group) ...@@ -1003,16 +1002,12 @@ static int genl_bind(struct net *net, int group)
err = f->mcast_bind(net, fam_grp); err = f->mcast_bind(net, fam_grp);
else else
err = 0; err = 0;
found = true;
break; break;
} }
} }
} }
up_read(&cb_lock); up_read(&cb_lock);
if (WARN_ON(!found))
err = 0;
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册