Skip to content

Commit 4e006c7

Browse files
Alexander Aringdavem330
Alexander Aring
authored andcommitted
net: rpl: fix rpl header size calculation
This patch fixes a missing 8 byte for the header size calculation. The ipv6_rpl_srh_size() is used to check a skb_pull() on skb->data which points to skb_transport_header(). Currently we only check on the calculated addresses fields using CmprI and CmprE fields, see: https://www.rfc-editor.org/rfc/rfc6554#section-3 there is however a missing 8 byte inside the calculation which stands for the fields before the addresses field. Those 8 bytes are represented by sizeof(struct ipv6_rpl_sr_hdr) expression. Fixes: 8610c7c ("net: ipv6: add support for rpl sr exthdr") Signed-off-by: Alexander Aring <[email protected]> Reported-by: maxpl0it <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6f48333 commit 4e006c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv6/rpl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ static void *ipv6_rpl_segdata_pos(const struct ipv6_rpl_sr_hdr *hdr, int i)
3232
size_t ipv6_rpl_srh_size(unsigned char n, unsigned char cmpri,
3333
unsigned char cmpre)
3434
{
35-
return (n * IPV6_PFXTAIL_LEN(cmpri)) + IPV6_PFXTAIL_LEN(cmpre);
35+
return sizeof(struct ipv6_rpl_sr_hdr) + (n * IPV6_PFXTAIL_LEN(cmpri)) +
36+
IPV6_PFXTAIL_LEN(cmpre);
3637
}
3738

3839
void ipv6_rpl_srh_decompress(struct ipv6_rpl_sr_hdr *outhdr,

0 commit comments

Comments
 (0)