Skip to contentSkip to conversation

net: rpl: fix rpl header size calculation

PATCH Applied Alexander Aring 3 participants 4 messages Apr 17, 2023 – Apr 19, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 8610c7c6e3bd ("net: ipv6: add support for rpl sr exthdr")

---
changes since v2:
- use sizeof(struct ipv6_rpl_sr_hdr) instead of hardcoded 8

 net/ipv6/rpl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/rpl.c +2 -1
index 488aec9e1a74..d1876f192225 100644
@@ -32,7 +32,8 @@ static void *ipv6_rpl_segdata_pos(const struct ipv6_rpl_sr_hdr *hdr, int i)
 size_t ipv6_rpl_srh_size(unsigned char n, unsigned char cmpri,
 			 unsigned char cmpre)
 {
-	return (n * IPV6_PFXTAIL_LEN(cmpri)) + IPV6_PFXTAIL_LEN(cmpre);
+	return sizeof(struct ipv6_rpl_sr_hdr) + (n * IPV6_PFXTAIL_LEN(cmpri)) +
+		IPV6_PFXTAIL_LEN(cmpre);
 }
 
 void ipv6_rpl_srh_decompress(struct ipv6_rpl_sr_hdr *outhdr,
Signature · 1 line
2.31.1
#1 lore raw

Hi,

Quoted 6 lines · Alexander Aring

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:

Quoted 8 lines

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 8610c7c6e3bd ("net: ipv6: add support for rpl sr exthdr")

I just got this information. Thanks for reporting it.

- Alex

Reviewed-by on v2 1/1
#2 lore raw
In reply to Alexander Aring
Quoted 11 lines · Alexander Aring

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.

Quoted 9 lines
Fixes 8610c7c6e3bd ("net: ipv6: add support for rpl sr exthdr")

---
changes since v2:
- use sizeof(struct ipv6_rpl_sr_hdr) instead of hardcoded 8

 net/ipv6/rpl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
#3 lore raw
In reply to Alexander Aring
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Mon, 17 Apr 2023 09:00:52 -0400 you wrote:

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

[...]

Here is the summary with links:
- [PATCHv2,net] net: rpl: fix rpl header size calculation

    https://git.kernel.org/netdev/net/c/4e006c7a6dac

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html