Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5796116imw; Wed, 20 Jul 2022 12:44:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ve+ZJ+xyos6KvhPg+4q7cWrWv0s4koRL7nyhk3uTjH/v/RgjJklfqtUbSONDn+RA43CH9G X-Received: by 2002:a05:6a00:ac1:b0:52b:5db8:f362 with SMTP id c1-20020a056a000ac100b0052b5db8f362mr22019109pfl.80.1658346269163; Wed, 20 Jul 2022 12:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658346269; cv=none; d=google.com; s=arc-20160816; b=OAdE/X9xtE21UOOL0PLpVAsDFRyH9RRAAdJO9q7Xij1HwTeg5CX1kdKJ62B/x/FXLl vAKzqimUbGDnlQJb8AVjABSCDKg7Ebbw6Nb8JCQS5TUKFIWsiAD6LirknowmUiyG+ZHq w+e4WZ3eUk3eZRuUpyvQ4WXc+zWPv8X2P/kdr63hXg3NO3cBalpbyLNgf5+bK1UIqWFI qLdGZdnCOvwmFbUYt0K367/Xn6tNyEhjZ9lFex1OuCYd3YklTV/jEcdDQUg3b1OMjkft mq65f4gvtioYpl6kp9QLUCOBc+v6PoWGT6E9slHeZNhkpqEI1fSB8Flvz/0s6lSGTyeg uILQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sNmHXXZLq2jUTUF2mL1N+GEOajV1BKDlOngeyvhbYnA=; b=g/ZRlezugElF+FRjpJlb1Ydo/yT7ClpKunBKynRZXoG5TmvSKWxiX0LlEwSrDvUkrU McM1BS8SwPYDTHmfW+TAizeCO27PgLxi1n68f9p0Or7dODbIc9CPKc30BG0Jxy2qpc1k zUh8pZCQQV7IvJtLr2Zc/j7dFLF6c46BVDhHBJH7M5OMBqS8nA5vXEgTOpWFQ+5Ho5Cs y0gF+i2P2MlWXjsi9E44z3lyoWVOFfWg5ion6RvG8f9SND7RUmQJcvhx+mjCH75XCf24 zQIN5wHnmgCrgAxgkIZQ+DvpYufBV9g12fEeszLpgaXFfmJR/fM8R5WAzDohgFldud5P r6cw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e15-20020a17090a9a8f00b001ef8f853cafsi1775277pjp.176.2022.07.20.12.44.14; Wed, 20 Jul 2022 12:44:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbiGTTO0 (ORCPT + 99 others); Wed, 20 Jul 2022 15:14:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbiGTTOX (ORCPT ); Wed, 20 Jul 2022 15:14:23 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD7BC5720B for ; Wed, 20 Jul 2022 12:14:22 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEF90-0004W8-0J; Wed, 20 Jul 2022 21:14:02 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oEF8v-0005MV-H8; Wed, 20 Jul 2022 21:13:57 +0200 Date: Wed, 20 Jul 2022 21:13:57 +0200 From: Oleksij Rempel To: Fedor Pchelkin Cc: Robin van der Gracht , Oleksij Rempel , 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: Re: [PATCH] can: j1939: Remove unnecessary WARN_ON_ONCE in j1939_sk_queue_activate_next_locked() Message-ID: <20220720191357.GB5600@pengutronix.de> References: <20220720110645.519601-1-pchelkin@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220720110645.519601-1-pchelkin@ispras.ru> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Hi Fedor, On Wed, Jul 20, 2022 at 02:06:45PM +0300, Fedor Pchelkin wrote: > 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? yes. > 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. No. It is not typical use case and most probably it will create problems. Are you working on some system where this use case is valid? > 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 > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |