Skip to content

Commit

Permalink
genetlink: A genl_bind() to an out-of-range multicast group should no…
Browse files Browse the repository at this point in the history
…t 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: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Dec 29, 2014
1 parent 023e2cf commit dc97a1a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,7 @@ static struct genl_multicast_group genl_ctrl_groups[] = {

static int genl_bind(struct net *net, int group)
{
int i, err;
bool found = false;
int i, err = 0;

down_read(&cb_lock);
for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
Expand All @@ -1003,16 +1002,12 @@ static int genl_bind(struct net *net, int group)
err = f->mcast_bind(net, fam_grp);
else
err = 0;
found = true;
break;
}
}
}
up_read(&cb_lock);

if (WARN_ON(!found))
err = 0;

return err;
}

Expand Down

0 comments on commit dc97a1a

Please sign in to comment.