diff mbox series

[net] net: veth: fix packet segmentation in veth_convert_skb_to_xdp_buff

Message ID eddfe549e7e626870071930964ac3c38a1dc8068.1701702000.git.lorenzo@kernel.org (mailing list archive)
State Accepted
Commit a61f46e1102545cf1fb5f19992288265362cefb0
Delegated to: Netdev Maintainers
Headers show
Series [net] net: veth: fix packet segmentation in veth_convert_skb_to_xdp_buff | 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/ynl success SINGLE THREAD; Generated files up to date; no warnings/errors;
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: 1115 this patch: 1115
netdev/cc_maintainers warning 5 maintainers not CCed: ast@kernel.org john.fastabend@gmail.com bpf@vger.kernel.org hawk@kernel.org daniel@iogearbox.net
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
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: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Lorenzo Bianconi Dec. 4, 2023, 3:01 p.m. UTC
Based on the previous allocated packet, page_offset can be not null
in veth_convert_skb_to_xdp_buff routine.
Take into account page fragment offset during the skb paged area copy
in veth_convert_skb_to_xdp_buff().

Fixes: 2d0de67da51a ("net: veth: use newly added page pool API for veth with xdp")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/veth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Yunsheng Lin Dec. 5, 2023, 12:26 a.m. UTC | #1
On 2023/12/4 23:01, Lorenzo Bianconi wrote:
> Based on the previous allocated packet, page_offset can be not null
> in veth_convert_skb_to_xdp_buff routine.
> Take into account page fragment offset during the skb paged area copy
> in veth_convert_skb_to_xdp_buff().
> 
> Fixes: 2d0de67da51a ("net: veth: use newly added page pool API for veth with xdp")

LGTM.
Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>

Thanks for the fix.

> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  drivers/net/veth.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 57efb3454c57..977861c46b1f 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -790,7 +790,8 @@ static int veth_convert_skb_to_xdp_buff(struct veth_rq *rq,
>  
>  			skb_add_rx_frag(nskb, i, page, page_offset, size,
>  					truesize);
> -			if (skb_copy_bits(skb, off, page_address(page),
> +			if (skb_copy_bits(skb, off,
> +					  page_address(page) + page_offset,
>  					  size)) {
>  				consume_skb(nskb);
>  				goto drop;
>
patchwork-bot+netdevbpf@kernel.org Dec. 6, 2023, 3:30 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  4 Dec 2023 16:01:48 +0100 you wrote:
> Based on the previous allocated packet, page_offset can be not null
> in veth_convert_skb_to_xdp_buff routine.
> Take into account page fragment offset during the skb paged area copy
> in veth_convert_skb_to_xdp_buff().
> 
> Fixes: 2d0de67da51a ("net: veth: use newly added page pool API for veth with xdp")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> [...]

Here is the summary with links:
  - [net] net: veth: fix packet segmentation in veth_convert_skb_to_xdp_buff
    https://git.kernel.org/netdev/net/c/a61f46e11025

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 57efb3454c57..977861c46b1f 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -790,7 +790,8 @@  static int veth_convert_skb_to_xdp_buff(struct veth_rq *rq,
 
 			skb_add_rx_frag(nskb, i, page, page_offset, size,
 					truesize);
-			if (skb_copy_bits(skb, off, page_address(page),
+			if (skb_copy_bits(skb, off,
+					  page_address(page) + page_offset,
 					  size)) {
 				consume_skb(nskb);
 				goto drop;