netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 net] net: rpl: fix rpl header size calculation
@ 2023-04-17 13:00 Alexander Aring
  2023-04-17 16:24 ` Alexander Aring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexander Aring @ 2023-04-17 13:00 UTC (permalink / raw)
  To: netdev
  Cc: davem, dsahern, edumazet, kuba, pabeni, alex.aring, daniel,
	ymittal, mcascell, torvalds, mcr

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")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
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(-)

diff --git a/net/ipv6/rpl.c b/net/ipv6/rpl.c
index 488aec9e1a74..d1876f192225 100644
--- a/net/ipv6/rpl.c
+++ b/net/ipv6/rpl.c
@@ -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,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 net] net: rpl: fix rpl header size calculation
  2023-04-17 13:00 [PATCHv2 net] net: rpl: fix rpl header size calculation Alexander Aring
@ 2023-04-17 16:24 ` Alexander Aring
  2023-04-17 17:51 ` David Ahern
  2023-04-19  8:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2023-04-17 16:24 UTC (permalink / raw)
  To: netdev
  Cc: davem, dsahern, edumazet, kuba, pabeni, alex.aring, daniel,
	ymittal, mcascell, torvalds, mcr, maxpl0it

Hi,

On Mon, Apr 17, 2023 at 9:09 AM Alexander Aring <aahringo@redhat.com> 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
>
> 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")
> Signed-off-by: Alexander Aring <aahringo@redhat.com>

Reported-by: maxpl0it <maxpl0it@protonmail.com>

I just got this information. Thanks for reporting it.

- Alex


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 net] net: rpl: fix rpl header size calculation
  2023-04-17 13:00 [PATCHv2 net] net: rpl: fix rpl header size calculation Alexander Aring
  2023-04-17 16:24 ` Alexander Aring
@ 2023-04-17 17:51 ` David Ahern
  2023-04-19  8:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2023-04-17 17:51 UTC (permalink / raw)
  To: Alexander Aring, netdev
  Cc: davem, edumazet, kuba, pabeni, alex.aring, daniel, ymittal,
	mcascell, torvalds, mcr

On 4/17/23 7:00 AM, Alexander Aring 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
> 
> 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")
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
> 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(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 net] net: rpl: fix rpl header size calculation
  2023-04-17 13:00 [PATCHv2 net] net: rpl: fix rpl header size calculation Alexander Aring
  2023-04-17 16:24 ` Alexander Aring
  2023-04-17 17:51 ` David Ahern
@ 2023-04-19  8:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-04-19  8:10 UTC (permalink / raw)
  To: Alexander Aring
  Cc: netdev, davem, dsahern, edumazet, kuba, pabeni, alex.aring,
	daniel, ymittal, mcascell, torvalds, mcr

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-19  8:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 13:00 [PATCHv2 net] net: rpl: fix rpl header size calculation Alexander Aring
2023-04-17 16:24 ` Alexander Aring
2023-04-17 17:51 ` David Ahern
2023-04-19  8:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).