diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c index 6cf0d0bc1e8d621295c93a4c831b231cec764417..a90005eac8b1700031a874e3300a3d363ec57bb3 100644 --- a/drivers/net/can/rx-offload.c +++ b/drivers/net/can/rx-offload.c @@ -261,8 +261,10 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload, struct sk_buff *skb) { if (skb_queue_len(&offload->skb_queue) > - offload->skb_queue_len_max) - return -ENOMEM; + offload->skb_queue_len_max) { + kfree_skb(skb); + return -ENOBUFS; + } skb_queue_tail(&offload->skb_queue, skb); can_rx_offload_schedule(offload);