aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-12-29 16:31:49 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-29 16:31:49 -0500
commitdc97a1a9477f969e34b38ca9d9cd231cb93ebea2 (patch)
treeec52826b2f5e7c917878ec4108e3e35a5f8f8598 /net
parent023e2cfa36c31b0ad28c159a1bb0d61ff57334c8 (diff)
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: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/genetlink.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 91566ed36c43..2e11061ef885 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -985,8 +985,7 @@ static struct genl_multicast_group genl_ctrl_groups[] = {
985 985
986static int genl_bind(struct net *net, int group) 986static int genl_bind(struct net *net, int group)
987{ 987{
988 int i, err; 988 int i, err = 0;
989 bool found = false;
990 989
991 down_read(&cb_lock); 990 down_read(&cb_lock);
992 for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { 991 for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
@@ -1003,16 +1002,12 @@ static int genl_bind(struct net *net, int group)
1003 err = f->mcast_bind(net, fam_grp); 1002 err = f->mcast_bind(net, fam_grp);
1004 else 1003 else
1005 err = 0; 1004 err = 0;
1006 found = true;
1007 break; 1005 break;
1008 } 1006 }
1009 } 1007 }
1010 } 1008 }
1011 up_read(&cb_lock); 1009 up_read(&cb_lock);
1012 1010
1013 if (WARN_ON(!found))
1014 err = 0;
1015
1016 return err; 1011 return err;
1017} 1012}
1018 1013