]> git.karo-electronics.de Git - linux-beck.git/commitdiff
gtp: gtp_check_src_ms_ipv4() always return success
authorLionel Gauthier <Lionel.Gauthier@eurecom.fr>
Thu, 15 Dec 2016 21:35:52 +0000 (22:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Dec 2016 17:00:25 +0000 (12:00 -0500)
gtp_check_src_ms_ipv4() did not find the PDP context matching with the
UE IP address because the memory location is not right, but the result
is inverted by the Boolean "not" operator.  So whatever is the PDP
context, any call to this function is successful.

Signed-off-by: Lionel Gauthier <Lionel.Gauthier@eurecom.fr>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/gtp.c

index 98f10c21652140a57cf2ee89ee1ff3b25a7802ba..6031d499f2beb4c936620bf9aff10eb908f6092d 100644 (file)
@@ -158,9 +158,9 @@ static bool gtp_check_src_ms_ipv4(struct sk_buff *skb, struct pdp_ctx *pctx,
        if (!pskb_may_pull(skb, hdrlen + sizeof(struct iphdr)))
                return false;
 
-       iph = (struct iphdr *)(skb->data + hdrlen + sizeof(struct iphdr));
+       iph = (struct iphdr *)(skb->data + hdrlen);
 
-       return iph->saddr != pctx->ms_addr_ip4.s_addr;
+       return iph->saddr == pctx->ms_addr_ip4.s_addr;
 }
 
 /* Check if the inner IP source address in this packet is assigned to any