bridge: Add missing ntohs()s for MLDv2 report parsing
authorLinus Lüssing <linus.luessing@web.de>
Tue, 15 Feb 2011 13:19:19 +0000 (13:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 Feb 2011 18:07:27 +0000 (10:07 -0800)
The nsrcs number is 2 Byte wide, therefore we need to call ntohs()
before using it.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_multicast.c

index d69beaf83627ec2c49fea6e6bd0302c72a9ba70a..9ce2af1877098d66a7c92219bc5e7d01a1ecef12 100644 (file)
@@ -1020,11 +1020,12 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br,
 
                if (!pskb_may_pull(skb,
                                   len + sizeof(*grec) +
-                                  sizeof(struct in6_addr) * (*nsrcs)))
+                                  sizeof(struct in6_addr) * ntohs(*nsrcs)))
                        return -EINVAL;
 
                grec = (struct mld2_grec *)(skb->data + len);
-               len += sizeof(*grec) + sizeof(struct in6_addr) * (*nsrcs);
+               len += sizeof(*grec) +
+                      sizeof(struct in6_addr) * ntohs(*nsrcs);
 
                /* We treat these as MLDv1 reports for now. */
                switch (grec->grec_type) {