diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-08-23 15:57:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-24 20:49:24 -0400 |
commit | 22df13319d1fec30b8f9bcaadc295829647109bb (patch) | |
tree | b61441ea39ac3c525746bfe8aaab9b6b5f9c6c63 /net/bridge/br_multicast.c | |
parent | 4b275d7efa1c4412f0d572fcd7f78ed0919370b3 (diff) |
bridge: fix a possible use after free
br_multicast_ipv6_rcv() can call pskb_trim_rcsum() and therefore skb
head can be reallocated.
Cache icmp6_type field instead of dereferencing twice the struct
icmp6hdr pointer.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_multicast.c')
-rw-r--r-- | net/bridge/br_multicast.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 22d2d1af1c83..995cbe0ac0b2 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1456,7 +1456,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
1456 | { | 1456 | { |
1457 | struct sk_buff *skb2; | 1457 | struct sk_buff *skb2; |
1458 | const struct ipv6hdr *ip6h; | 1458 | const struct ipv6hdr *ip6h; |
1459 | struct icmp6hdr *icmp6h; | 1459 | u8 icmp6_type; |
1460 | u8 nexthdr; | 1460 | u8 nexthdr; |
1461 | unsigned len; | 1461 | unsigned len; |
1462 | int offset; | 1462 | int offset; |
@@ -1502,9 +1502,9 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
1502 | __skb_pull(skb2, offset); | 1502 | __skb_pull(skb2, offset); |
1503 | skb_reset_transport_header(skb2); | 1503 | skb_reset_transport_header(skb2); |
1504 | 1504 | ||
1505 | icmp6h = icmp6_hdr(skb2); | 1505 | icmp6_type = icmp6_hdr(skb2)->icmp6_type; |
1506 | 1506 | ||
1507 | switch (icmp6h->icmp6_type) { | 1507 | switch (icmp6_type) { |
1508 | case ICMPV6_MGM_QUERY: | 1508 | case ICMPV6_MGM_QUERY: |
1509 | case ICMPV6_MGM_REPORT: | 1509 | case ICMPV6_MGM_REPORT: |
1510 | case ICMPV6_MGM_REDUCTION: | 1510 | case ICMPV6_MGM_REDUCTION: |
@@ -1544,7 +1544,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
1544 | 1544 | ||
1545 | BR_INPUT_SKB_CB(skb)->igmp = 1; | 1545 | BR_INPUT_SKB_CB(skb)->igmp = 1; |
1546 | 1546 | ||
1547 | switch (icmp6h->icmp6_type) { | 1547 | switch (icmp6_type) { |
1548 | case ICMPV6_MGM_REPORT: | 1548 | case ICMPV6_MGM_REPORT: |
1549 | { | 1549 | { |
1550 | struct mld_msg *mld; | 1550 | struct mld_msg *mld; |