can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once
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> Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
ad9294dbc2
commit
8cb68751c1
|
@ -721,20 +721,16 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
{
|
{
|
||||||
struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
|
struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
|
||||||
|
|
||||||
if (WARN_ONCE(dev->type != ARPHRD_CAN ||
|
if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU ||
|
||||||
skb->len != CAN_MTU ||
|
cfd->len > CAN_MAX_DLEN)) {
|
||||||
cfd->len > CAN_MAX_DLEN,
|
pr_warn_once("PF_CAN: dropped non conform CAN skbuf: dev type %d, len %d, datalen %d\n",
|
||||||
"PF_CAN: dropped non conform CAN skbuf: "
|
dev->type, skb->len, cfd->len);
|
||||||
"dev type %d, len %d, datalen %d\n",
|
kfree_skb(skb);
|
||||||
dev->type, skb->len, cfd->len))
|
return NET_RX_DROP;
|
||||||
goto drop;
|
}
|
||||||
|
|
||||||
can_receive(skb, dev);
|
can_receive(skb, dev);
|
||||||
return NET_RX_SUCCESS;
|
return NET_RX_SUCCESS;
|
||||||
|
|
||||||
drop:
|
|
||||||
kfree_skb(skb);
|
|
||||||
return NET_RX_DROP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int canfd_rcv(struct sk_buff *skb, struct net_device *dev,
|
static int canfd_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
|
|
Loading…
Reference in New Issue