From: Ziyang Xuan Date: Thu, 15 Sep 2022 01:55:56 +0000 (+0800) Subject: can: bcm: check the result of can_send() in bcm_can_tx() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9baf100006756643d31e37bbc50fe9d6f2af4881;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git can: bcm: check the result of can_send() in bcm_can_tx() [ 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 --- 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)