Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp883174rwi; Wed, 19 Oct 2022 04:16:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65fpPbnMEeiq8BLAkg40SNa8xl8c1yMqMx04pXTq38OZ2JGE+dNxlqEarJ8BDBtkxQpeM6 X-Received: by 2002:a17:90a:e7ca:b0:20a:966e:8480 with SMTP id kb10-20020a17090ae7ca00b0020a966e8480mr44185050pjb.100.1666178219172; Wed, 19 Oct 2022 04:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178219; cv=none; d=google.com; s=arc-20160816; b=bFju2h0hXhXYqFasl9jRIptgFnzI7/TgltqFi7EoZFn8L0/kh4l5gPyv/q24PjpVbQ +7y8DhoaoGCuJ81fk9FxcSWjGE1t9F2PO+3hdph3yS+ExrAwYz6E2DgDCSHdAXzGI/ov eCfhGbl24NdU9ZxM77cnW2TGCW0CJdrxILyUK6K0lawzIIwuZ1EoQLTzR+6Za0OVnV70 nUIRDIfK64V0GvrQ5M4gFiEkp0OBiZyKTItLaj21yhEWNYuYeYarU18ruBdmqcst5c1o wIwuIRZY6+0drpGl4/y5trcMYo83M4FTs77Dpd7MfKl4AerPFmT9qjkO9YaoH981HDkE sXIg== 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=Bvop/fiX8oo9wmbXwfDKLsyD0kIhNNKOKZW1TjHzQEc=; b=kQjnea2It21JQf3dlAF/izOpRWiJxbXUEESNK6MvND35lYJq+Zq36E17cgAPsP/dOE pBx9MKtyNjGFg6X5v+X6juAHzOYdxHrF4AzEjVlGY3XJWjOTWTaVruS54+RPsM9YJ4uv eSQNF5LgKPHi97JpgcveYvMGIDK1yoZ1frAzxJB0c21Ujwszwz5kA1pNYDJTU972QAIu Y3O9dS8VVPHPvaJ86KKs5N0SwwR86fMlCR2cX3YP4/SREfw6HvMg+pTwti4C5fsqO4iF SYNk8dEPjbcor2rZIUDQhrti0r0+y+hIGkpHdSEquhQ1dkVHquU/Nf3x3R2B1aZHU8tD kQ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eKVReiPA; 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 d4-20020a170902854400b0017dafc02313si18018918plo.92.2022.10.19.04.16.46; Wed, 19 Oct 2022 04:16:59 -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=eKVReiPA; 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 S234592AbiJSKvj (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234572AbiJSKta (ORCPT ); Wed, 19 Oct 2022 06:49:30 -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 C54C215A335; Wed, 19 Oct 2022 03:22:11 -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 D467AB824C5; Wed, 19 Oct 2022 09:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FA9CC433C1; Wed, 19 Oct 2022 09:11:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170681; bh=Cq0O6Lq0YGpcmM8L/xBbBUGYACre6Ya9iOwxDcgfiwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eKVReiPAVG9Jhd5gqZMiiK0NQFtTU/1fbN5yl/CjRlYiXaAklmkHV9RVz8VZrLMBw HGtDdkdmIa7SWGV7gL40VEXZ/uk2wMolvL8wGKlyorGn3TCHNp9BOx8ycbBP/s7mlv tUohhIzLzCCZRF2eAvURLD/6z/Ww4TEnVxqB5r8M= 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 6.0 713/862] can: bcm: check the result of can_send() in bcm_can_tx() Date: Wed, 19 Oct 2022 10:33:20 +0200 Message-Id: <20221019083321.432851272@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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 e60161bec850..f16271a7ae2e 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -274,6 +274,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) @@ -298,11 +299,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