From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18DEAC43603 for ; Wed, 4 Dec 2019 18:01:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DEC342073B for ; Wed, 4 Dec 2019 18:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482508; bh=Q1BI4t7VuryP7jp7IngtWsjMIyxCI9X1WHqqjjPUh1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZNzbe5DUdJuWp+CX66EtJEVt9aYldW3oCGmJBQjBDdFCYgmsGX5RWlDaYUctDRap5 A93XIO8kjz/LcSGmUwyBAVaT422C8ikZOmw4gRA8kMB3yK4lDuWagr/9DrC/DDi0yl 5gi06xG6AD3q7y6DG3okcGLfNeSAGMvkFl/++AGc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729661AbfLDSBs (ORCPT ); Wed, 4 Dec 2019 13:01:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:42572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729644AbfLDSBl (ORCPT ); Wed, 4 Dec 2019 13:01:41 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C2CA20675; Wed, 4 Dec 2019 18:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482501; bh=Q1BI4t7VuryP7jp7IngtWsjMIyxCI9X1WHqqjjPUh1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hyT9FL4n4xUAxPyk5j+aLZx3JQcImKFF/Yd8PsfLlvoIJXntC7qPYQp1jEMUd5HM3 xi0oAtRXP/QVSUVpScJxqGzC1H0ITLEGij5PyozXRW8pvgR12NkiepaSQ48j3Fx55f q3dzFRI/MhkcsTG65eHUsdo75qxcyY8KW9yVKhI4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeroen Hofstee , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 4.14 021/209] can: rx-offload: can_rx_offload_irq_offload_timestamp(): continue on error Date: Wed, 4 Dec 2019 18:53:53 +0100 Message-Id: <20191204175322.977400077@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeroen Hofstee [ Upstream commit c2a9f74c9d18acfdcabd3361adc7eac82c537a66 ] 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. However can_rx_offload_irq_offload_timestamp() bails out in the error case. In case of a resource shortage all mailboxes should be discarded, to avoid an IRQ storm and give the system some time to recover. Since can_rx_offload_irq_offload_timestamp() is typically called from a while loop, all message will eventually be discarded. So let's continue on error instead to discard them directly. Signed-off-by: Jeroen Hofstee Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/rx-offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c index 840aef094f208..fef6534f163b7 100644 --- a/drivers/net/can/rx-offload.c +++ b/drivers/net/can/rx-offload.c @@ -225,7 +225,7 @@ int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 pen skb = can_rx_offload_offload_one(offload, i); if (IS_ERR_OR_NULL(skb)) - break; + continue; __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare); } -- 2.20.1