[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230718175919.59600-1-kuniyu@amazon.com>
Date: Tue, 18 Jul 2023 10:59:19 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <ruc_gongyuanjun@....com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <netdev@...r.kernel.org>,
<timur@...nel.org>, Kuniyuki Iwashima <kuniyu@...zon.com>
Subject: Re: [PATCH 1/1] drivers: net: fix return value check in emac_tso_csum()
From: Yuanjun Gong <ruc_gongyuanjun@....com>
Date: Mon, 17 Jul 2023 22:46:21 +0800
> in emac_tso_csum(), return an error code if an unexpected value
> is returned by pskb_trim().
>
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@....com>
Fixes: b9b17debc69d ("net: emac: emac gigabit ethernet controller driver")
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> drivers/net/ethernet/qualcomm/emac/emac-mac.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
> index 0d80447d4d3b..d5c688a8d7be 100644
> --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
> +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
> @@ -1260,8 +1260,11 @@ static int emac_tso_csum(struct emac_adapter *adpt,
> if (skb->protocol == htons(ETH_P_IP)) {
> u32 pkt_len = ((unsigned char *)ip_hdr(skb) - skb->data)
> + ntohs(ip_hdr(skb)->tot_len);
> - if (skb->len > pkt_len)
> - pskb_trim(skb, pkt_len);
> + if (skb->len > pkt_len) {
> + ret = pskb_trim(skb, pkt_len);
> + if (unlikely(ret))
> + return ret;
> + }
> }
>
> hdr_len = skb_tcp_all_headers(skb);
> --
> 2.17.1
Powered by blists - more mailing lists