summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2019-09-24 21:45:38 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-05 11:19:43 +0300
commitee798153829321cc25fcdd86f1e3e74accc4b0b6 (patch)
treefdf7752397719e00d0424dbef82b4bea23f6bac8
parent5c8f5485614c17dd8918d790cedd13f710809197 (diff)
downloadlinux-ee798153829321cc25fcdd86f1e3e74accc4b0b6.tar.xz
can: rx-offload: can_rx_offload_irq_offload_fifo(): continue on error
[ Upstream commit 1f7f504dcd9d1262437bdcf4fa071e41dec1af03 ] In case of a resource shortage, i.e. the rx_offload queue will overflow or a skb fails to be allocated (due to OOM), can_rx_offload_offload_one() will call mailbox_read() to discard the mailbox and return an ERR_PTR. If the hardware FIFO is empty can_rx_offload_offload_one() will return NULL. In case a CAN frame was read from the hardware, can_rx_offload_offload_one() returns the skb containing it. Without this patch can_rx_offload_irq_offload_fifo() bails out if no skb returned, regardless of the reason. Similar to can_rx_offload_irq_offload_timestamp() in case of a resource shortage the whole FIFO should be discarded, to avoid an IRQ storm and give the system some time to recover. However if the FIFO is empty the loop can be left. With this patch the loop is left in case of empty FIFO, but not on errors. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/can/rx-offload.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c
index 0dded7a1067b..5f7e97d54733 100644
--- a/drivers/net/can/rx-offload.c
+++ b/drivers/net/can/rx-offload.c
@@ -257,7 +257,9 @@ int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload)
while (1) {
skb = can_rx_offload_offload_one(offload, 0);
- if (IS_ERR_OR_NULL(skb))
+ if (IS_ERR(skb))
+ continue;
+ if (!skb)
break;
skb_queue_tail(&offload->skb_queue, skb);