Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1330197pxk; Thu, 10 Sep 2020 12:40:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzghHWV//Z83viNO47D//QMQqOKPBziofia7nx4fnnioTZldAc0C3nzG5xU88TKs3Bgpr53 X-Received: by 2002:a17:906:cf9b:: with SMTP id um27mr10614068ejb.66.1599766848450; Thu, 10 Sep 2020 12:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599766848; cv=none; d=google.com; s=arc-20160816; b=WNine8gXXYfeoXiS2rTicHW9bjz90NhtqXgz/UKz8nD68Awzj6dALZ3TpdoCaNTKEk 7A+Y91zVlCgJAB1E0N74QoW74oWI9D3Yus0K7U9QajtyWCwv1QD6eqvfbP4OUzrqChlQ HUjyQV9OJ1mrkCD2SM2svUxLAgFVLIpjTII/Qtkonx0G5UY8Dsf+6rstycGkDB7bHB1y ndWEeuBuhkcM5X/Rf0Hcfej1K/U6nKSIqxHKyPVtUJK3iUX+vT5ErrwJBn077fQwB6RV WvWhdUbXRZWmo04EVJ6bkhIXrN9lqsBIoXSc3qv9AMixhQ25bkSh7Im218HYnPBZWMii hmmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=9YJdkboqBPrHbO9Xi1ZZSzhXfRXKEyNsoYN1A1/WPTM=; b=VyN1LSK0PiML9QOWMo4llxjYjpkuLDfUlCHrBrLf23s+Sqhg9wm2gyNRn4Kf07g0O3 KrmqqzVmOevzOO4fqx8QdRDep07hQyqGxm96CzN/VL5kgHrKdY1O0dQaTfL8mdz8Rmsl DsVmifr9U0Ts36hV2pPxs8WsOI5czDq26uEm29IPc2z1mN+Z7nK1Lz1AtYlng9CbZMX0 MWBmdxNR+aXbEuIfVdbzyT1Kq1ZAo4OYl2KYbohGNKukJBW0i4chTIKmbEuTul5cNMiU XN2gJjfRmF5OxnFwEgrK9cTyHlmDWIPSiEbubO5C/MNOqy1Qth4wiYOsFJ1+iblAzwfm 5MLQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si4418694ejy.634.2020.09.10.12.40.25; Thu, 10 Sep 2020 12:40:48 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728045AbgIJTj2 (ORCPT + 99 others); Thu, 10 Sep 2020 15:39:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727997AbgIJTjO (ORCPT ); Thu, 10 Sep 2020 15:39:14 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB64DC061573; Thu, 10 Sep 2020 12:39:14 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 3D25712A30019; Thu, 10 Sep 2020 12:22:27 -0700 (PDT) Date: Thu, 10 Sep 2020 12:39:13 -0700 (PDT) Message-Id: <20200910.123913.1333297432408477303.davem@davemloft.net> To: linyunsheng@huawei.com Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, john.fastabend@gmail.com, eric.dumazet@gmail.com Subject: Re: [PATCH v2 net] net: sch_generic: aviod concurrent reset and enqueue op for lockless qdisc From: David Miller In-Reply-To: <1599562954-87257-1-git-send-email-linyunsheng@huawei.com> References: <1599562954-87257-1-git-send-email-linyunsheng@huawei.com> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [2620:137:e000::1:9]); Thu, 10 Sep 2020 12:22:27 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin Date: Tue, 8 Sep 2020 19:02:34 +0800 > Currently there is concurrent reset and enqueue operation for the > same lockless qdisc when there is no lock to synchronize the > q->enqueue() in __dev_xmit_skb() with the qdisc reset operation in > qdisc_deactivate() called by dev_deactivate_queue(), which may cause > out-of-bounds access for priv->ring[] in hns3 driver if user has > requested a smaller queue num when __dev_xmit_skb() still enqueue a > skb with a larger queue_mapping after the corresponding qdisc is > reset, and call hns3_nic_net_xmit() with that skb later. > > Reused the existing synchronize_net() in dev_deactivate_many() to > make sure skb with larger queue_mapping enqueued to old qdisc(which > is saved in dev_queue->qdisc_sleeping) will always be reset when > dev_reset_queue() is called. > > Fixes: 6b3ba9146fe6 ("net: sched: allow qdiscs to handle locking") > Signed-off-by: Yunsheng Lin > --- > ChangeLog V2: > Reuse existing synchronize_net(). Applied and queued up for -stable, thank you.