netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers:net: fix return value check in mlx5e_ipsec_remove_trailer
@ 2023-07-17 14:46 Yuanjun Gong
  2023-07-17 18:48 ` Tariq Toukan
  2023-07-17 18:55 ` Leon Romanovsky
  0 siblings, 2 replies; 5+ messages in thread
From: Yuanjun Gong @ 2023-07-17 14:46 UTC (permalink / raw)
  To: Yuanjun Gong, Saeed Mahameed, Boris Pismenny, Leon Romanovsky,
	netdev

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(-)

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


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

end of thread, other threads:[~2023-07-26 11:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 14:46 [PATCH 1/1] drivers:net: fix return value check in mlx5e_ipsec_remove_trailer Yuanjun Gong
2023-07-17 18:48 ` Tariq Toukan
2023-07-17 18:55 ` Leon Romanovsky
2023-07-25  6:56   ` [PATCH net v2 1/1] net/mlx5e: fix return value check in mlx5e_ipsec_remove_trailer() Yuanjun Gong
2023-07-26 11:41     ` Leon Romanovsky

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).