Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2674396pxb; Mon, 6 Sep 2021 02:45:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLQcOePpbnQqQG2tByp6tlifVLDESzioobf5zB0YLiPmzvkKZi0Dp4XSBaNgZTGuwm1qL3 X-Received: by 2002:aa7:d501:: with SMTP id y1mr12651663edq.6.1630921507129; Mon, 06 Sep 2021 02:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630921507; cv=none; d=google.com; s=arc-20160816; b=rUMGRkeednxc9J2aD/kOMsci88lpf84O+H7zx8kB7bhrgPCEkIxx84/nGJ8u9ReNDh FAlV31bHZHfc7RRVYbvmGZVvePHPEpiuhX7ExBar+TH+d6QnUBBCqSOop8Ue9n0MQ3ml bA0k7IDWdVDF7o5SgoQBYt4c0tSBBEH5hJYfRuAXw/dUretvK0pLrC1pUuul52xBtp8g RGLWNjqq72stMkjbTT7l0/1kgIhr1etQ15ARDdpiKSLY5REPTCpGzXIBtvSe/hQ3O6/T RBOD1jR6A3VmME0uhli+FocNfiniJV8rhq63XAl+0+FgB6n6EJi84rPy0fnL3ZcXXwrz hEKw== 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 :message-id:date:subject:cc:to:from; bh=mJxVO5KAfSPmucbTRxi39582IVJeCqTOT1EVn9hzvnQ=; b=oQUIGe21aPj5x2zAM+RoDTlEFJUMHH7ED940wqsepv9as0/ESpD7V8kIaa/sYsviEb cpp8H3+6VaiFYW8srr40ljOq55+/gq7/PRYjs2rrA1BCoJJDuZWQV7yGbDnX7NYzp8au gNNFKaL/BKtSfZNXCiOwio/VxbGHaE68dvXdXT55/J/69unXUdVH8fgQLmyIoIsP+u+X hUotZTTPSqhFRMnVGMLa2KT/R7Ac2uYwpVuybE/B5x66DQApYA+xdi0LgcNik7QRiBhb r3WxBzR/LhQwxYadgDmNqgkLRiDh+k/2R2szm+SRsVE027O9Mvrxa+kjvx7rEXDQVClc mIXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd30si7293549ejc.717.2021.09.06.02.44.42; Mon, 06 Sep 2021 02:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241571AbhIFJo0 (ORCPT + 99 others); Mon, 6 Sep 2021 05:44:26 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:15294 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241546AbhIFJoR (ORCPT ); Mon, 6 Sep 2021 05:44:17 -0400 Received: from dggeml757-chm.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4H33NL5N1Jz8srt; Mon, 6 Sep 2021 17:42:42 +0800 (CST) Received: from localhost.localdomain (10.175.104.82) by dggeml757-chm.china.huawei.com (10.1.199.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Mon, 6 Sep 2021 17:43:09 +0800 From: Ziyang Xuan To: CC: , , , , , , , Subject: [PATCH net] can: j1939: fix errant alert in j1939_tp_rxtimer Date: Mon, 6 Sep 2021 17:42:19 +0800 Message-ID: <20210906094219.95924-1-william.xuanziyang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeml757-chm.china.huawei.com (10.1.199.137) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the session state is J1939_SESSION_DONE, j1939_tp_rxtimer() will give an alert "rx timeout, send abort", but do nothing actually. Move the alert into session active judgment condition, it is more reasonable. One of the scenarioes is that j1939_tp_rxtimer() execute followed by j1939_xtp_rx_abort_one(). After j1939_xtp_rx_abort_one(), the session state is J1939_SESSION_DONE, then j1939_tp_rxtimer() give an alert. Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Signed-off-by: Ziyang Xuan --- net/can/j1939/transport.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c index 0f8309314075..d3f0a062b400 100644 --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -1226,12 +1226,11 @@ static enum hrtimer_restart j1939_tp_rxtimer(struct hrtimer *hrtimer) session->err = -ETIME; j1939_session_deactivate(session); } else { - netdev_alert(priv->ndev, "%s: 0x%p: rx timeout, send abort\n", - __func__, session); - j1939_session_list_lock(session->priv); if (session->state >= J1939_SESSION_ACTIVE && session->state < J1939_SESSION_ACTIVE_MAX) { + netdev_alert(priv->ndev, "%s: 0x%p: rx timeout, send abort\n", + __func__, session); j1939_session_get(session); hrtimer_start(&session->rxtimer, ms_to_ktime(J1939_XTP_ABORT_TIMEOUT_MS), -- 2.25.1