Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp314641imn; Fri, 29 Jul 2022 07:42:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR5pOTcMvEAAntaKUwG301gvvNAIyDje0CoUYyxBsZ3VSe0yXCCyKIRaN3jNMi6xZcjramrB X-Received: by 2002:a17:902:ba91:b0:16d:3119:7fea with SMTP id k17-20020a170902ba9100b0016d31197feamr4262303pls.57.1659105755721; Fri, 29 Jul 2022 07:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659105755; cv=none; d=google.com; s=arc-20160816; b=Smds1Rlittp2mePk4u+DfFpGFv8mb16KzdX79nz6m9GGK4kgUSBkew+vAUYveb6WMu mZGV5iWD+dcmGI5xTGgh2ckLikC/mBgNq8EQwe9k3jIdHPRCnqIfygL23+SsIf9MiUsN RN7WcylcFo7DbQYcq/sxtgHv/FRBX5hxC/eIvRmNWdaVhyyu+MaJ73didURiH4V5bf29 tGnTPRsfjO8F4lx6sq0D55qiwnzN5JiDY2Kr597TPNflKlMWoHNBEltjmtfceinPLCCY i0RwDrB0GpaJhcAnMe0G+K3RxWFBVaWoW19zxvn9qjBaCCck+FLCWnZDa0jOwz7cw2Wb GX+Q== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=s5jwVNMVX1giJ5cJp99gLPKi7i/SszN4LAuoS78+oR0=; b=Og9ao/hD+jqEvNFin3HwGaGfQXQ7hKc4Ocq9F4A7z+R5t7IaNmQLE7nb4EUnBY+gkb P6MZ9TR9oHiWQNZ3QAH+nDcejtW5lhzhWrzbxyOO5rPLNwYbLGZjV81SnCGo4vh7JpgF nidvoIBLpYW0KcDiG1467A67bsnyQQP7ZKX7BcmnEqT0EaEdaV6NCSrucJQV+3lshXYE kumXgCE2f5M2XoAGit8e5lfbgiSvFkRsQeYXtHJ5CRY1TKnBAU3lAUolyJau1N2p/NK9 Qd8JJU4iigFyEBhR53UdD2/jP32H22T8/bFgBRTpxNZyTJ6I7Ex4FU+vP3qmLUEAwuJv kBdw== 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 q9-20020a654949000000b004161e72a055si4450761pgs.310.2022.07.29.07.42.21; Fri, 29 Jul 2022 07:42:35 -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 S237075AbiG2O05 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 29 Jul 2022 10:26:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237067AbiG2O0y (ORCPT ); Fri, 29 Jul 2022 10:26:54 -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 DFA9E11838 for ; Fri, 29 Jul 2022 07:26:52 -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 1oHQwn-0000r1-E9; Fri, 29 Jul 2022 16:26:37 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oHQwk-0002Ri-Ul; Fri, 29 Jul 2022 16:26:34 +0200 Date: Fri, 29 Jul 2022 16:26:34 +0200 From: Oleksij Rempel To: Fedor Pchelkin Cc: Robin van der Gracht , Oleksij Rempel , kernel@pengutronix.de, Oliver Hartkopp , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov , ldv-project@linuxtesting.org Subject: Re: [PATCH v2] can: j1939: Replace WARN_ON_ONCE with netdev_warn_once() in j1939_sk_queue_activate_next_locked() Message-ID: <20220729142634.GD10850@pengutronix.de> References: <20220728165828.GB30201@pengutronix.de> <20220729140609.980154-1-pchelkin@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20220729140609.980154-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 On Fri, Jul 29, 2022 at 05:06:09PM +0300, Fedor Pchelkin wrote: > We should warn user-space that it is doing something wrong when trying to > activate sessions with identical parameters but WARN_ON_ONCE macro can not > be used here as it serves a different purpose. > > So it would be good to replace it with netdev_warn_once() message. > > 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 Acked-by: Oleksij Rempel > --- > v1 -> v2: Used netdev_warn_once() instead of pr_warn_once() > > net/can/j1939/socket.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c > index f5ecfdcf57b2..09e1d78bd22c 100644 > --- a/net/can/j1939/socket.c > +++ b/net/can/j1939/socket.c > @@ -178,7 +178,10 @@ 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)) { > + netdev_warn_once(first->priv->ndev, > + "%s: 0x%p: Identical session is already activated.\n", > + __func__, 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 |