Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7311744rwi; Mon, 24 Oct 2022 12:46:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WzPhrx5nIckjQGSSD/ZJhOIwQYCZXperiXYJ8WCutdojUeNfQgnx3HTgD3Sajn5Z5ae4K X-Received: by 2002:a17:907:7d8f:b0:78e:2cba:560f with SMTP id oz15-20020a1709077d8f00b0078e2cba560fmr29521855ejc.173.1666640788967; Mon, 24 Oct 2022 12:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640788; cv=none; d=google.com; s=arc-20160816; b=rbnRfHsaeHaUIX64mFc8cRR2vqWOLbUIU/4WX42lU52Qv4jZdGfeGbpaxqCVcisoeZ Sjma9UDyf3g1+FxnwIhQ4jZhsRAFANw9qVegxd0rZvjHQsY4VVqiKIVr7JhjUIbtWlVI 3cXJxiVruloxrcQgstODMJ02fMeMjB/4RReJ6rN52dDzvK9dPxzclbDB1E/BeabXUMey XXmLNfjGVjZnA6o/2Iq6acpmGeY0msbYYmPm1GjAXDV8aY2ngfs2lEgrVSoz2nLcSWjW rAAgT1d2CtB9GWoXV4QDvHxKEp4gqBJVT8s4yXsVnx/2YYmpFtbbTOiueJm0BpriNqbS U9rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y4/fcxXNEiIZeGM+5Lc9ZpSABJfmBYqQEtjGaIgweRM=; b=KrxUpIDa5VVOw9dIaU07odnAjYiSQgR3Ux+Lp06rZTzTELaw4NlVcZAmIAiOZaduxK XZEINM5x+3HX+TmwDs0FfyD66+ufR5K9XwyD9Eg8/eRo7Ix/V61m1d/HA136SMMTkw6r wATKOYDcCl0/qEJGLyNQs61HOtn0fx3cwfU0CNy7T1bM43v4R1uJiSMAQj8IsxtK9ZpS Fr/ZdcNcNjIx1k8BypgJpwPeqxlq6AVwW5l77IzTNQiYoNyyu+srCOMTcBx3kRySM8QX xsd82F245VQZGDEdZjpGAM9CMFpFTM6hYeTmiZhlf56nhJhITKSIH8A0ITeUCd2QSS/k rNTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C/Ogn7CK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he43-20020a1709073dab00b007a8c58b51a3si677151ejc.725.2022.10.24.12.45.57; Mon, 24 Oct 2022 12:46:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C/Ogn7CK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbiJXTmY (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233416AbiJXTlY (ORCPT ); Mon, 24 Oct 2022 15:41:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C8BA2608E3; Mon, 24 Oct 2022 11:11:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 14FFCB81133; Mon, 24 Oct 2022 11:53:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD4EC433C1; Mon, 24 Oct 2022 11:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612378; bh=g7jL3VwSFDP45ZHiaaVV5tuoAna1OHEHuXqpaCKJgWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/Ogn7CK2Hx4eE+omtdHoUUzZMW/nvBbouQsR5L0XeYVJeQrQx4UC3G5Xaoauk4nd 4fTC1lSlSgrf004A3SgrKuQDadLF/Xpg3IeMc5l56KD5v8xtpGaejgzDOqFE3UbUcJ d+Ykd8fGRu0iDnTzO+P0HFSoyySarT29z0vuHXkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , Ziyang Xuan , Sasha Levin Subject: [PATCH 4.14 176/210] can: bcm: check the result of can_send() in bcm_can_tx() Date: Mon, 24 Oct 2022 13:31:33 +0200 Message-Id: <20221024113002.665476166@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ziyang Xuan [ Upstream commit 3fd7bfd28cfd68ae80a2fe92ea1615722cc2ee6e ] If can_send() fail, it should not update frames_abs counter in bcm_can_tx(). Add the result check for can_send() in bcm_can_tx(). Suggested-by: Marc Kleine-Budde Suggested-by: Oliver Hartkopp Signed-off-by: Ziyang Xuan Link: https://lore.kernel.org/all/9851878e74d6d37aee2f1ee76d68361a46f89458.1663206163.git.william.xuanziyang@huawei.com Acked-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- net/can/bcm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/can/bcm.c b/net/can/bcm.c index b3f3b02ffd42..89b955ef75d1 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -286,6 +286,7 @@ static void bcm_can_tx(struct bcm_op *op) struct sk_buff *skb; struct net_device *dev; struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; + int err; /* no target device? => exit */ if (!op->ifindex) @@ -310,11 +311,11 @@ static void bcm_can_tx(struct bcm_op *op) /* send with loopback */ skb->dev = dev; can_skb_set_owner(skb, op->sk); - can_send(skb, 1); + err = can_send(skb, 1); + if (!err) + op->frames_abs++; - /* update statistics */ op->currframe++; - op->frames_abs++; /* reached last frame? */ if (op->currframe >= op->nframes) -- 2.35.1