diff mbox series

[1/1] drivers:net: fix return value check in mlx5e_ipsec_remove_trailer

Message ID 20230717144640.23166-1-ruc_gongyuanjun@163.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [1/1] drivers:net: fix return value check in mlx5e_ipsec_remove_trailer | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1342 this patch: 1342
netdev/cc_maintainers warning 6 maintainers not CCed: kuba@kernel.org steffen.klassert@secunet.com davem@davemloft.net pabeni@redhat.com edumazet@google.com linux-rdma@vger.kernel.org
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
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 No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1365 this patch: 1365
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yuanjun Gong July 17, 2023, 2:46 p.m. UTC
mlx5e_ipsec_remove_trailer should return an error code if function
pskb_trim returns an unexpected value.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tariq Toukan July 17, 2023, 6:48 p.m. UTC | #1
On 17/07/2023 17:46, Yuanjun Gong wrote:
> mlx5e_ipsec_remove_trailer should return an error code if function
> pskb_trim returns an unexpected value.
> 

It's a fix, please add a Fixes tag.

> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
> index eab5bc718771..8d995e304869 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
> @@ -58,7 +58,9 @@ static int mlx5e_ipsec_remove_trailer(struct sk_buff *skb, struct xfrm_state *x)
>   
>   	trailer_len = alen + plen + 2;
>   
> -	pskb_trim(skb, skb->len - trailer_len);
> +	ret = pskb_trim(skb, skb->len - trailer_len);
> +	if (unlikely(ret))
> +		return ret;
>   	if (skb->protocol == htons(ETH_P_IP)) {
>   		ipv4hdr->tot_len = htons(ntohs(ipv4hdr->tot_len) - trailer_len);
>   		ip_send_check(ipv4hdr);

Other than that:
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Leon Romanovsky July 17, 2023, 6:55 p.m. UTC | #2
On Mon, Jul 17, 2023 at 10:46:40PM +0800, Yuanjun Gong wrote:
> mlx5e_ipsec_remove_trailer should return an error code if function
> pskb_trim returns an unexpected value.
> 
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Please add fixes line, change title to be "net/mlx5e: ...." instead of
"drivers:..." and target tree which is "net".

Thanks

> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
> index eab5bc718771..8d995e304869 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
> @@ -58,7 +58,9 @@ static int mlx5e_ipsec_remove_trailer(struct sk_buff *skb, struct xfrm_state *x)
>  
>  	trailer_len = alen + plen + 2;
>  
> -	pskb_trim(skb, skb->len - trailer_len);
> +	ret = pskb_trim(skb, skb->len - trailer_len);
> +	if (unlikely(ret))
> +		return ret;
>  	if (skb->protocol == htons(ETH_P_IP)) {
>  		ipv4hdr->tot_len = htons(ntohs(ipv4hdr->tot_len) - trailer_len);
>  		ip_send_check(ipv4hdr);
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
index eab5bc718771..8d995e304869 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
@@ -58,7 +58,9 @@  static int mlx5e_ipsec_remove_trailer(struct sk_buff *skb, struct xfrm_state *x)
 
 	trailer_len = alen + plen + 2;
 
-	pskb_trim(skb, skb->len - trailer_len);
+	ret = pskb_trim(skb, skb->len - trailer_len);
+	if (unlikely(ret))
+		return ret;
 	if (skb->protocol == htons(ETH_P_IP)) {
 		ipv4hdr->tot_len = htons(ntohs(ipv4hdr->tot_len) - trailer_len);
 		ip_send_check(ipv4hdr);