From: Lionel Gauthier Date: Thu, 15 Dec 2016 21:35:52 +0000 (+0100) Subject: gtp: gtp_check_src_ms_ipv4() always return success X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=88edf10315c8d72db70d39f3851cf2c91abdb634;p=linux-beck.git gtp: gtp_check_src_ms_ipv4() always return success 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 Signed-off-by: Pablo Neira Ayuso Signed-off-by: David S. Miller --- diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index 98f10c216521..6031d499f2be 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -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