Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5354715imw; Wed, 20 Jul 2022 04:13:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vMftXAAeo+6HIgvxsXAp8vSbAYXEyHLBSQiQL50jXjyz4OTQ8aLpNY1ynR+JRSIXQ7zUXd X-Received: by 2002:a05:6808:2006:b0:33a:991e:3520 with SMTP id q6-20020a056808200600b0033a991e3520mr2128627oiw.10.1658315637065; Wed, 20 Jul 2022 04:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658315637; cv=none; d=google.com; s=arc-20160816; b=cMvMRgA9S7sySZhusoW07BznxcJWzQIw9FyTA2iInp5/0qKbtiUG23TumRdULStUOa 8/2JFVi2v95KRUP3ajhQeinnf4KH2AoO5clIpF5Qg3fI4zl5arQwuTi23pC9F+MIwjc3 BzDVcliPXV5Ov3/WqGgHvSPiIHupgNtVDYTm22Waw4qHsbtp5aO2iKx95jRM71iMcCEp Wf2ArS4rMa5Y6Odn4aTlJiJi+qHXJ3a3I4qjFWrDHhHIEUFpj7VWPxxLXT9tvP8cxddl 5N3FIYPPpH2249xBX/vkephe8zcSfDBEgjSuiUOqWNwz0vdF78z4/zUeh5NBXoRH/fpn UabA== 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=2xGP7bB054NX+FkmltitIWyeTAfSeZc3p+AQBBqODhw=; b=FWbI0amZv1EZOJR9dvGymO/1vz+51emRrsyR52nOBqGJskr1Gj+X7hElz+Htg+Vosx rEbwKktB/3LAYXoK8nWAtFSa4V/rdfbCzynD46uxCDoJYpI12AFouU8gChv0Qgq4T8uC acjiH5eYq/pOc1N34ZUv89KSyyNP8dY1135ql3P0aXDFxxY8q05wxc5B8CUYpsHPvjQH aYm3loYngqPQQl9fKEi7+M/1CXwPjW2kz1qOc2fznyEQhPhtjAHl3ZF11Z4K0j3TLT9c nQCgfD+sipQlsSko1ZC7/77qDq4Opv/UR+jwAUaFRLjIGWtW4tNgidrbT0dgvNywDp8Y tWTg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l37-20020a0568302b2500b0061c57f3a06csi18221542otv.82.2022.07.20.04.13.44; Wed, 20 Jul 2022 04:13:57 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231546AbiGTLHO (ORCPT + 99 others); Wed, 20 Jul 2022 07:07:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbiGTLHL (ORCPT ); Wed, 20 Jul 2022 07:07:11 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D1D4B0D7; Wed, 20 Jul 2022 04:07:09 -0700 (PDT) Received: from localhost.localdomain (unknown [46.242.14.200]) by mail.ispras.ru (Postfix) with ESMTPSA id 08A0D40737AC; Wed, 20 Jul 2022 11:07:06 +0000 (UTC) From: Fedor Pchelkin To: Robin van der Gracht , Oleksij Rempel Cc: Fedor Pchelkin , Pengutronix Kernel Team , Oliver Hartkopp , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Elenita Hinds , Kurt Van Dijck , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov Subject: [PATCH] can: j1939: Remove unnecessary WARN_ON_ONCE in j1939_sk_queue_activate_next_locked() Date: Wed, 20 Jul 2022 14:06:45 +0300 Message-Id: <20220720110645.519601-1-pchelkin@ispras.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 The purpose of WARN_ON_ONCE if the session with the same parameters has already been activated and is currently in active_session_list is not very clear. Is this warning implemented to indicate that userspace is doing something wrong? As far as I can see, there are two lists: active_session_list (which is for the whole device) and sk_session_queue (which is unique for each j1939_sock), and the situation when we have two sessions with the same type, addresses and destinations in two different sk_session_queues (owned by two different sockets) is actually highly probable - one is active and the other is willing to become active but the j1939_session_activate() does not let that happen. It is correct behaviour as I assume. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Signed-off-by: Fedor Pchelkin Signed-off-by: Alexey Khoroshilov --- net/can/j1939/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c index f5ecfdcf57b2..be4b73afa16c 100644 --- a/net/can/j1939/socket.c +++ b/net/can/j1939/socket.c @@ -178,7 +178,7 @@ static void j1939_sk_queue_activate_next_locked(struct j1939_session *session) if (!first) return; - if (WARN_ON_ONCE(j1939_session_activate(first))) { + if (j1939_session_activate(first)) { first->err = -EBUSY; goto activate_next; } else { -- 2.25.1