can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once
Subsystems (2)
PATCH 1/2 can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once
In Linux 4.12 commit 8e8cda6d737d356054c ("can: initial support for network namespaces") removed a namespace check which affected this patch:
upstream commit 8cb68751c115d176ec851ca56ecfbb411568c9e8
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.
--- net/can/af_can.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/can/af_can.c +5 -6
@@ -722,13 +722,12 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,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 ;
Signature · 1 line
2.15.1
PATCH 2/2 can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once
In Linux 4.12 commit 8e8cda6d737d356054c ("can: initial support for network namespaces") removed a namespace check which affected this patch:
can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once
upstream commit d4689846881d160a4d12a514e991a740bcb5d65a
If an invalid CANFD 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.
--- net/can/af_can.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/can/af_can.c +5 -6
@@ -745,13 +745,12 @@ static int canfd_rcv(struct sk_buff *skb, struct net_device *dev,if (unlikely (!net_eq (dev_net (dev), &init_net))) goto drop; -if (WARN_ONCE (dev->type !=ARPHRD_CAN || - skb->len !=CANFD_MTU || - cfd->len >CANFD_MAX_DLEN , -"PF_CAN: dropped non conform CAN FD skbuf: " -"dev type %d, len %d, datalen %d\n" , - dev->type, skb->len, cfd->len)) +if (unlikely (dev->type !=ARPHRD_CAN || skb->len !=CANFD_MTU || + cfd->len >CANFD_MAX_DLEN )) { +pr_warn_once ("PF_CAN: dropped non conform CAN FD 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 ;
Signature · 1 line
2.15.1
Greg KH
maintainerRe: [PATCH 2/2] [stable pre-4.12] can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once
Quoted 2 lines · Oliver Hartkopp
In Linux 4.12 commit
8e8cda6d737d356054c("can: initial support for network namespaces") removed a namespace check which affected this patch:
Thanks for the two backports, now queued up.
greg k-h
Marc Kleine-Budde
maintainerQuoted 14 lines · Oliver Hartkopp
In Linux 4.12 commit
8e8cda6d737d356054c("can: initial support for network namespaces") removed a namespace check which affected this patch:upstream commit
8cb68751c115d176ec851ca56ecfbb411568c9e8can:
af_can:can_rcv(): replaceWARN_ONCEbypr_warn_onceIf an invalid CAN frame is received, from a driver or from a tun interface, a Kernel warning is generated.
This patch replaces the
WARN_ONCEby a simplepr_warn_once, so that a kernel, bootet withpanic_on_warn, does not panic. A printk seems to be more appropriate here.
Quoted 6 lines
Reported-by [email protected]Suggested-by Dmitry Vyukov <[email protected]>Acked-by Oliver Hartkopp <[email protected]>Cc linux-stable <[email protected]> [pre 4.12]Signed-off-by Marc Kleine-Budde <[email protected]>Signed-off-by Oliver Hartkopp <[email protected]>
nice!
thnx,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |