[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230718175515.58952-1-kuniyu@amazon.com>
Date: Tue, 18 Jul 2023 10:55:15 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <ruc_gongyuanjun@....com>
CC: <alexandre.belloni@...tlin.com>, <claudiu.manoil@....com>,
<netdev@...r.kernel.org>, <vladimir.oltean@....com>, Kuniyuki Iwashima
<kuniyu@...zon.com>
Subject: [PATCH 1/1] drivers:net: fix return value check in ocelot_fdma_receive_skb
From: Yuanjun Gong <ruc_gongyuanjun@....com>
Date: Mon, 17 Jul 2023 22:46:52 +0800
> ocelot_fdma_receive_skb should return false if an unexpected
> value is returned by pskb_trim.
>
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@....com>
Fixes: 753a026cfec1 ("net: ocelot: add FDMA support")
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> drivers/net/ethernet/mscc/ocelot_fdma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mscc/ocelot_fdma.c b/drivers/net/ethernet/mscc/ocelot_fdma.c
> index 8e3894cf5f7c..83a3ce0c568e 100644
> --- a/drivers/net/ethernet/mscc/ocelot_fdma.c
> +++ b/drivers/net/ethernet/mscc/ocelot_fdma.c
> @@ -368,7 +368,8 @@ static bool ocelot_fdma_receive_skb(struct ocelot *ocelot, struct sk_buff *skb)
> if (unlikely(!ndev))
> return false;
>
> - pskb_trim(skb, skb->len - ETH_FCS_LEN);
> + if (pskb_trim(skb, skb->len - ETH_FCS_LEN))
> + return false;
>
> skb->dev = ndev;
> skb->protocol = eth_type_trans(skb, skb->dev);
> --
> 2.17.1
Powered by blists - more mailing lists