Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp67304rwd; Wed, 17 May 2023 14:49:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kU4YkOj7Gb6FZo+wwteh6ANOZNC1dfHzPfs3XQm7UMyEm7aJmubtY8q1FKVwzu2rN1pjk X-Received: by 2002:a17:902:efd1:b0:1ae:56ff:74a with SMTP id ja17-20020a170902efd100b001ae56ff074amr161825plb.58.1684360190284; Wed, 17 May 2023 14:49:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684360190; cv=none; d=google.com; s=arc-20160816; b=cE1m8Uw+FXqZOCPwAAGviG5Xj002QkR7MAEDg9LuCCd87dhP5b1IBHqSVxnVzQWjcK iJAK1ICbhrxNMW21XXbayvp0bluTf/MOGQ4whLfrkhUaHc4LuAqlCUabQP+oGYlagTox SZL32eqgfTARl3Cj7hXqR4QkHpBG5yxHqymNNXM2+f7z4DgxKY6sUz7wq8JUhoLsWRXb UWdTqGZ+z7kPdOv3emBO2wEpJEFyF7XSZy2cIKXeuDSuO4MPWOCiLUuq+X/blE4P0DpF 9sTe+LriFcm651XQ2ZuQ9Aw3vOEWYs+J8iUw7qWIr3SvecnsEEFj6BSjTtnZirZ+9XLN noDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N6vL2fsfxq6/38TDdxu0CBw8vPRGY2/MXlHJiOSzTok=; b=GIfgZlTQ8rFEVMS9vD7RtJ1FWPqv9Z/VGVkDdiPcunon6inkKfn3h8mmbYP6S/boEA /30M74c67h0sVogLjjJjTu/fRiITJ8rtX/N5TBOI/zGsuOUNY5i0ILfLrwjGrE8W5dBc gq9XeUMEzZGObKWbK3Z+Q32jLOtecrM1LmWKjyOHOlN+BDszbRgwzo1jtpNhGULjkdqT 5bDlCzNF6SXiVDQlFZcrVGL7fDzGd2TgrhKF24w1hZSbQwFzK9+iWeBxbeNTgYoQZMR8 pmHzk4S89o724VtL2rXxnRR+0i/hI2A8zXjMwzUE6e7yM1VdhnJmohMLBUs8l99X7gHA kxlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y17VeasK; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a170902d51200b001a988a09b6esi24433501plg.252.2023.05.17.14.49.16; Wed, 17 May 2023 14:49:50 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y17VeasK; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbjEQVTb (ORCPT + 99 others); Wed, 17 May 2023 17:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbjEQVTO (ORCPT ); Wed, 17 May 2023 17:19:14 -0400 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D54AD2D9; Wed, 17 May 2023 14:18:56 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6ab113d8589so1133922a34.3; Wed, 17 May 2023 14:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684358312; x=1686950312; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=N6vL2fsfxq6/38TDdxu0CBw8vPRGY2/MXlHJiOSzTok=; b=Y17VeasKT/R0ZHCm8xlJ33mSiSE2pBG+Pzej6dc7OpxPh/vJYpVoNsa1ejlkrZMJ2N yUFR5J2olLz4pc1XvXxgxmKPOLbopDaqydk9E30DjUIJmxJj05NcE89mAITWk3B7L9EO sP59s6IfUdxhBnmy7ghAIVBtWPCzkYF5XSmmG7FoU6M1M+1qGapJCDCXmqvcXN99EB+Y GgbPG+7Z3h1VCiv8JD4uLehwl2ONHCKwS2K3FCjVZaHDom6uOMIgE4AEzfCM9h9cnOpt 7PrgK5Xue9xOEdgLDbWJnLcCsMmXl8UnNF9yFZktt+NQ4RReFy+Z8TtlKP6Jcaxah4qH wsRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684358312; x=1686950312; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=N6vL2fsfxq6/38TDdxu0CBw8vPRGY2/MXlHJiOSzTok=; b=K6/mcUlGZR07f/TxN/E2ZUplhwMhnEVsyED1RlvHDBC4VmM0ac00R8O8XhrsQINHCk Rf4KB/ZrMJSp+mDjVhaMqLgqvJCQTB1X+SZsSp4Bfac/GK1dSocn/Dv8wYY3OiZCmfaH /RkUwJ1Op0DlGUUPl58l8KVjLEnpZaJGrGyfYKaj9/7r2bsqjsNVOqswm6+zJ/qEU4qG 5tOzLHXDXkAEiL4753k03SUd1IVIswZouaGoWzicg/RHx24rMntkaqV6Zy3X8pIDpEFN DLFOEAwZTwuhK7gkvDQWZTIUWA7o2ildbb2tCax3kFR9ezqbM1zAAKhQHsnCOWuQJA8e c08Q== X-Gm-Message-State: AC+VfDykTxqSiEXVgMJzO/ak5j271KNhAWJEkBNykOWjHiJyDEIqhjdM vln1+NPcO2hS1YEMzEtBQQ== X-Received: by 2002:a05:6830:1659:b0:6ab:31ed:85ef with SMTP id h25-20020a056830165900b006ab31ed85efmr89568otr.27.1684358312444; Wed, 17 May 2023 14:18:32 -0700 (PDT) Received: from C02FL77VMD6R ([208.184.112.130]) by smtp.gmail.com with ESMTPSA id dj15-20020a0568303a8f00b006a65be836acsm46300otb.16.2023.05.17.14.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 14:18:32 -0700 (PDT) Date: Wed, 17 May 2023 14:18:28 -0700 From: Peilin Ye To: Jakub Kicinski Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Peilin Ye , Daniel Borkmann , John Fastabend , Vlad Buslov , Pedro Tammela , Hillf Danton , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang Subject: Re: [PATCH net 6/6] net/sched: qdisc_destroy() old ingress and clsact Qdiscs before grafting Message-ID: References: <20230517114825.5d7c85a4@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230517114825.5d7c85a4@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, May 17, 2023 at 11:48:25AM -0700, Jakub Kicinski wrote: > > } else { > > - dev_queue = dev_ingress_queue(dev); > > - old = dev_graft_qdisc(dev_queue, new); > > + old = dev_graft_qdisc(dev_queue, NULL); > > + > > + /* {ingress,clsact}_destroy() "old" before grafting "new" to avoid > > + * unprotected concurrent accesses to net_device::miniq_{in,e}gress > > + * pointer(s) in mini_qdisc_pair_swap(). > > + */ > > + qdisc_notify(net, skb, n, classid, old, new, extack); > > + qdisc_destroy(old); > > + > > + dev_graft_qdisc(dev_queue, new); > > BTW can't @old be NULL here? ingress_queue->qdisc_sleeping is initialized to &noop_qdisc (placeholder) in dev_ingress_queue_create(), and dev_graft_qdisc() also grafts &noop_qdisc to represent "there's no Qdisc": /* ... and graft new one */ if (qdisc == NULL) qdisc = &noop_qdisc; dev_queue->qdisc_sleeping = qdisc; So @old can't be NULL here. Thanks, Peilin Ye