Skip to content

Commit 7f91ed8

Browse files
skorpion17davem330
authored andcommitted
seg6: fix srh pointer in get_srh()
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent acb9bdc commit 7f91ed8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/ipv6/seg6_local.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ static struct ipv6_sr_hdr *get_srh(struct sk_buff *skb)
8181
if (!pskb_may_pull(skb, srhoff + len))
8282
return NULL;
8383

84+
/* note that pskb_may_pull may change pointers in header;
85+
* for this reason it is necessary to reload them when needed.
86+
*/
87+
srh = (struct ipv6_sr_hdr *)(skb->data + srhoff);
88+
8489
if (!seg6_validate_srh(srh, len))
8590
return NULL;
8691

0 commit comments

Comments
 (0)