]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
seg6: fix srh pointer in get_srh()
authorAndrea Mayer <andrea.mayer@uniroma2.it>
Sat, 16 Nov 2019 15:05:52 +0000 (16:05 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 16 Nov 2019 20:18:32 +0000 (12:18 -0800)
pskb_may_pull may change pointers in header. For this reason, it is
mandatory to reload any pointer that points into skb header.

Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/seg6_local.c

index 9d4f75e0d33a7c685ec32110e96e46ab2e013457..5e3d7004d43144ca4a1ba82a2f415da88e2e33dd 100644 (file)
@@ -81,6 +81,11 @@ static struct ipv6_sr_hdr *get_srh(struct sk_buff *skb)
        if (!pskb_may_pull(skb, srhoff + len))
                return NULL;
 
+       /* note that pskb_may_pull may change pointers in header;
+        * for this reason it is necessary to reload them when needed.
+        */
+       srh = (struct ipv6_sr_hdr *)(skb->data + srhoff);
+
        if (!seg6_validate_srh(srh, len))
                return NULL;