]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
can: rx-offload: can_rx_offload_offload_one(): do not increase the skb_queue beyond...
authorMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 9 Oct 2019 14:03:18 +0000 (16:03 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 4 Nov 2019 20:47:21 +0000 (21:47 +0100)
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: d254586c3453 ("can: rx-offload: Add support for HW fifo based irq offloading")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/rx-offload.c

index d1c8634099450a0148a3dda65c41f33bb76c285a..bdc27481b57f9453e095899e4c7f13fadc4fd3b0 100644 (file)
@@ -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);