diff mbox series

[PATCHv2,net] net: rpl: fix rpl header size calculation

Message ID 20230417130052.2316819-1-aahringo@redhat.com (mailing list archive)
State Accepted
Commit 4e006c7a6dac0ead4c1bf606000aa90a372fc253
Delegated to: Netdev Maintainers
Headers show
Series [PATCHv2,net] net: rpl: fix rpl header size calculation | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Alexander Aring April 17, 2023, 1 p.m. UTC
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(-)

Comments

Alexander Aring April 17, 2023, 4:24 p.m. UTC | #1
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
David Ahern April 17, 2023, 5:51 p.m. UTC | #2
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>
patchwork-bot+netdevbpf@kernel.org April 19, 2023, 8:10 a.m. UTC | #3
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!
diff mbox series

Patch

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,