lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220828184748.e446pjykjklesxja@soft-dev3-1.localhost>
Date:   Sun, 28 Aug 2022 20:47:48 +0200
From:   Horatiu Vultur <horatiu.vultur@...rochip.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
CC:     <UNGLinuxDriver@...rochip.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        "Paolo Abeni" <pabeni@...hat.com>, <netdev@...r.kernel.org>,
        <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH net] net: lan966x: improve error handle in
 lan966x_fdma_rx_get_frame()

The 08/26/2022 18:00, Dan Carpenter wrote:
> 
> Don't just print a warning.  Clean up and return an error as well.

Reviewed-by: Horatiu Vultur <horatiu.vultur@...rochip.com>

> 
> Fixes: c8349639324a ("net: lan966x: Add FDMA functionality")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
>  drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> index 6dea7f8c1481..51f8a0816377 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> @@ -425,7 +425,8 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx)
>         lan966x_ifh_get_src_port(skb->data, &src_port);
>         lan966x_ifh_get_timestamp(skb->data, &timestamp);
> 
> -       WARN_ON(src_port >= lan966x->num_phys_ports);
> +       if (WARN_ON(src_port >= lan966x->num_phys_ports))
> +               goto free_skb;
> 
>         skb->dev = lan966x->ports[src_port]->dev;
>         skb_pull(skb, IFH_LEN * sizeof(u32));
> @@ -449,6 +450,8 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx)
> 
>         return skb;
> 
> +free_skb:
> +       kfree_skb(skb);
>  unmap_page:
>         dma_unmap_page(lan966x->dev, (dma_addr_t)db->dataptr,
>                        FDMA_DCB_STATUS_BLOCKL(db->status),
> --
> 2.35.1
> 

-- 
/Horatiu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ