From patchwork Mon Oct 24 11:31:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp571512wru; Mon, 24 Oct 2022 10:33:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dnk3mAhNTabFx+CgVrMNb113z7XsvwVNVETCwyMgBO5oZetMKFiU6854xkRzLbuZDxytS X-Received: by 2002:a05:6a00:1acd:b0:56b:8181:d78d with SMTP id f13-20020a056a001acd00b0056b8181d78dmr13426878pfv.50.1666632799053; Mon, 24 Oct 2022 10:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632799; cv=none; d=google.com; s=arc-20160816; b=dVurFEmHgSYuFZwDTySo1705c481uZaTKuwmeggsWF8+0n9e9rckzrRMmQA2VsrdU8 n3FCdD+j1Nwv5jmgcJKGzaGOCDmLbqDDeSxMWxjpthw90c4SumSp8/IcHbk8X5DJs9cl vVDR13jXg+BNx49gSpR2sDE7YgLigDmO+8GU0X6TwISlzqG+6p778FNxU36vZl/CcRGu ozvSFHS/OZFwvbUL/MwYp+Dw6MA+4orpt8bhzP7ZSre9vIT8SWcHuNyDRnk+vjNFcTXN F8J4pgCxb+E2AF54g6l0KL9PwqpTj9mBxlq0mB/1BQpMyc/+GEIZ15RE28ru+Qer1TTU B9dw== 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=Xea3MDJMMsqpbd3YGxLLNJXKCNg7Xf4g7W3G5mMNdFM=; b=VoNgFiW6QCg0opqPj5HHLSIDDEnogSFiC1yv+czGw+RgpxkMv7RLTBNWDS89hf2sD+ IXhIBD6ZZ0BEFhORmcjA6HorLqd7jaQSMnF53Qu9wHbBwRpGhC/P6dlp789a+gvuyfZL 1IqgbZsNVP9swKWBtim9LXitmdrNkb5zdk48Cz8YCvkUoCmqxcruoZ6pvDQtIAkmQOI+ IogqqwSUuNIeecKxbGt4P07HkIWuIijPwNuGREXDr9UkS01ze2VqqupJVyHFyo5iNoJV 4oCbIpImlAS/pQbHhOl8QaplOx87VMyHaZocKeynHBV9tBVHO5K69SJmVfHLnCyUIQzR Y/Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q22QP8Ko; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020a17090a380d00b0020a97a92a2fsi475037pjb.135.2022.10.24.10.33.05; Mon, 24 Oct 2022 10:33:19 -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=q22QP8Ko; 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 S229833AbiJXRcG (ORCPT + 99 others); Mon, 24 Oct 2022 13:32:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232940AbiJXRbe (ORCPT ); Mon, 24 Oct 2022 13:31:34 -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 888A343615; Mon, 24 Oct 2022 09:06:58 -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 C3E89B816A9; Mon, 24 Oct 2022 12:30:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 240F5C433D6; Mon, 24 Oct 2022 12:30:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614628; bh=WtmUHpXH7zAUYwCL3i2VSbXYr6kSqUkFecpd0pNxcTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q22QP8Konm7p4P1vFgMeEkPJ/gqNB06zuzOi7z/Tw6IQJ9lElnyFrkDY2p0i/b1Ax 1SOYhMl5krRNTvD6x2PxKSZw65ha0z9RDKnCGkvppeLVCWU6HyH9rqdTQYdeP9leI4 8Fw4v+q6TOZ37PUy2d+CkRAzwc7xDicwUJ7yvUH8= 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 5.10 316/390] can: bcm: check the result of can_send() in bcm_can_tx() Date: Mon, 24 Oct 2022 13:31:53 +0200 Message-Id: <20221024113036.443708770@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591153995187758?= X-GMAIL-MSGID: =?utf-8?q?1747591153995187758?= 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 e918a0f3cda2..afa82adaf6cd 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)