[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWUv+f=b4cMDX7dbK0fW=YnL=L11ODvZc9mh+L-02jo_w@mail.gmail.com>
Date:   Sun, 15 Dec 2019 18:59:49 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Aditya Pakki <pakki001@....edu>
Cc:     Kangjie Lu <kjlu@....edu>, "David S. Miller" <davem@...emloft.net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Allison Randal <allison@...utok.net>,
        Richard Fontana <rfontana@...hat.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yang Wei <yang.wei9@....com.cn>,
        netdev <netdev@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: caif: replace BUG_ON with recovery code
Hi Aditya,
On Sun, Dec 15, 2019 at 6:51 PM Aditya Pakki <pakki001@....edu> wrote:
> In caif_xmit, there is a crash if the ptr dev is NULL. However, by
> returning the error to the callers, the error can be handled. The
> patch fixes this issue.
>
> Signed-off-by: Aditya Pakki <pakki001@....edu>
Thanks for your patch!
> --- a/drivers/net/caif/caif_serial.c
> +++ b/drivers/net/caif/caif_serial.c
> @@ -270,7 +270,9 @@ static int caif_xmit(struct sk_buff *skb, struct net_device *dev)
>  {
>         struct ser_device *ser;
>
> -       BUG_ON(dev == NULL);
> +       if (WARN_ON(!dev))
This will still crash the kernel with panic_on_warn.
> +               return -EINVAL;
> +
>         ser = netdev_priv(dev);
>
>         /* Send flow off once, on high water mark */
Gr{oetje,eeting}s,
                        Geert
-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Powered by blists - more mailing lists
 
