lkml.org 
[lkml]   [2018]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.18 22/52] can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once
    Date
    3.18-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Marc Kleine-Budde <mkl@pengutronix.de>

    commit 8cb68751c115d176ec851ca56ecfbb411568c9e8 upstream.

    If an invalid CAN frame is received, from a driver or from a tun
    interface, a Kernel warning is generated.

    This patch replaces the WARN_ONCE by a simple pr_warn_once, so that a
    kernel, bootet with panic_on_warn, does not panic. A printk seems to be
    more appropriate here.

    Reported-by: syzbot+4386709c0c1284dca827@syzkaller.appspotmail.com
    Suggested-by: Dmitry Vyukov <dvyukov@google.com>
    Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


    ---
    net/can/af_can.c | 11 +++++------
    1 file changed, 5 insertions(+), 6 deletions(-)

    --- a/net/can/af_can.c
    +++ b/net/can/af_can.c
    @@ -719,13 +719,12 @@ static int can_rcv(struct sk_buff *skb,
    if (unlikely(!net_eq(dev_net(dev), &init_net)))
    goto drop;

    - if (WARN_ONCE(dev->type != ARPHRD_CAN ||
    - skb->len != CAN_MTU ||
    - cfd->len > CAN_MAX_DLEN,
    - "PF_CAN: dropped non conform CAN skbuf: "
    - "dev type %d, len %d, datalen %d\n",
    - dev->type, skb->len, cfd->len))
    + if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU ||
    + cfd->len > CAN_MAX_DLEN)) {
    + pr_warn_once("PF_CAN: dropped non conform CAN skbuf: dev type %d, len %d, datalen %d\n",
    + dev->type, skb->len, cfd->len);
    goto drop;
    + }

    can_receive(skb, dev);
    return NET_RX_SUCCESS;

    \
     
     \ /
      Last update: 2018-01-29 22:21    [W:5.059 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site