Commit a2dc3f5e authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: rx-offload: can_rx_offload_offload_one(): do not increase the skb_queue...

can: rx-offload: can_rx_offload_offload_one(): do not increase the skb_queue beyond skb_queue_len_max

The skb_queue is a linked list, holding the skb to be processed in the
next NAPI call.

Without this patch, the queue length in can_rx_offload_offload_one() is
limited to skb_queue_len_max + 1. As the skb_queue is a linked list, no
array or other resources are accessed out-of-bound, however this
behaviour is counterintuitive.

This patch limits the rx-offload skb_queue length to skb_queue_len_max.

Fixes: d254586c ("can: rx-offload: Add support for HW fifo based irq offloading")
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 6caf8a6d
......@@ -115,7 +115,7 @@ static struct sk_buff *can_rx_offload_offload_one(struct can_rx_offload *offload
int ret;
/* If queue is full or skb not available, read to discard mailbox */
if (likely(skb_queue_len(&offload->skb_queue) <=
if (likely(skb_queue_len(&offload->skb_queue) <
offload->skb_queue_len_max))
skb = alloc_can_skb(offload->dev, &cf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment