OSDN Git Service

can: rx-offload: can_rx_offload_queue_tail(): fix error handling, avoid skb mem leak
authorMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 9 Oct 2019 13:48:48 +0000 (15:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 08:19:41 +0000 (09:19 +0100)
commit77f94f0d7f523691b9b677e1f683ad7d01640d60
tree2a74ef18b1a2f731158e95a3fdc554aaf3806eca
parent66e21b7b9251fd9deb9b873221fe9fcab0c56e71
can: rx-offload: can_rx_offload_queue_tail(): fix error handling, avoid skb mem leak

[ Upstream commit 6caf8a6d6586d44fd72f4aa1021d14aa82affafb ]

If the rx-offload skb_queue is full can_rx_offload_queue_tail() will not
queue the skb and return with an error.

This patch frees the skb in case of a full queue, which brings
can_rx_offload_queue_tail() in line with the
can_rx_offload_queue_sorted() function, which has been adjusted in the
previous patch.

The return value is adjusted to -ENOBUFS to better reflect the actual
problem.

The device stats handling is left to the caller.

Fixes: d254586c3453 ("can: rx-offload: Add support for HW fifo based irq offloading")
Reported-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/rx-offload.c