Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8526743rwi; Tue, 25 Oct 2022 07:44:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BMZwLULsZYwx0P7L8L/nEViPk55/mMj+cb7+B46yXyauAMOhvYixmZ3+bHGrr5ukx4z/2 X-Received: by 2002:a17:907:80b:b0:77a:86a1:db52 with SMTP id wv11-20020a170907080b00b0077a86a1db52mr34098363ejb.294.1666709071149; Tue, 25 Oct 2022 07:44:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666709071; cv=none; d=google.com; s=arc-20160816; b=HAmVFBI21dKCZ0NuMT8crz7mEzzPCsK7qxzHE7QEAiQV9haTpsPfsvvaS3mH8QrWop 8lrkUweHwr3DDS3RB8dhZ+fBgmgUljsGuxim4ZWgfNh7CVmjorYzgU/VgBKTkIzbA9Zf B2PST8izSfMwdSOoEXX+Q5c9ITJX6rc9VR6Kdb7+xk3xUeTpXxzNz9fHEHJqVx5uRB0X lUuinPC6T+SZ8JIXmVNts4NnTMlnSAzf/BqkHPgSfTKovo2tv4eWQw3PHbhn7GIG3nl8 wK/Vl8cOTcC9I9xzNPXuRXjGh0lp4lvGctqLhtmw+PFsFqcG9bvWPmG63lnLR31DDJkq 4z+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:dkim-signature:message-id; bh=oMWWNsKJxRGWGVtwpSwnVRdeesdsVLQdOdYgkIbjK5k=; b=FOk1bG6q+YRLuZsTBTz2OKFXc3pvCq9gNogyGLcaXV8TFWpSGEwlCNFm2hmqVHlPbm MReUgBaE9Y2yVpn92eI67nrKDL0V3eAdmfmBt7WQ2S09fKfQlqmqp4bB3u/JFFy1Edtz 2cVvo9ZtuOMgwLH9q40cGR9xChDbHX+lb8SA5tRJSOD5RxG9K1MBu+9dDsWSRxoeOR1C I4d4ouKmvaHj7qve1bvdGLBQaWG4KrF23V4EnRWpt99ifzKGVj7IoqRgyoKdiqMDNOD/ pmxTBhf2XncKe328LoKT6YCV5bX2oqqdrzAhhRIpHH8UqheSO3777A6Me6vnLSL9V/XC 02yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wetzel-home.de header.s=wetzel-home header.b="hbSgDeB/"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wetzel-home.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a50bb0d000000b00461c7ad026csi2790810ede.61.2022.10.25.07.44.11; Tue, 25 Oct 2022 07:44:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@wetzel-home.de header.s=wetzel-home header.b="hbSgDeB/"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wetzel-home.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232265AbiJYOmZ (ORCPT + 65 others); Tue, 25 Oct 2022 10:42:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232630AbiJYOmV (ORCPT ); Tue, 25 Oct 2022 10:42:21 -0400 Received: from ns2.wdyn.eu (ns2.wdyn.eu [5.252.227.236]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 41AD917D879 for ; Tue, 25 Oct 2022 07:42:18 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wetzel-home.de; s=wetzel-home; t=1666708934; bh=pvZvWzjCJT9uqVogpxiNJDc4fo+HVrkaM7QPvG6nolU=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=hbSgDeB/zzWcssq/NYbqiPnwXx4vAG2rJav00L0DIRZd5x4nfgOrQDraOyRUIejt1 ktDePBHh5g7FZFtnB0wFMUGYlfXtNpOfEbgbB37H+uGV/Ba+Gb3q4y5Ed21ohzlpch toF9kRQg0MX48tNFXuNzdZL3g9L0Fz+k55gpzYEA= Date: Tue, 25 Oct 2022 16:42:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH] wifi: mac80211: fix general-protection-fault in ieee80211_subif_start_xmit() Content-Language: en-US To: Zhengchao Shao , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, johannes@sipsolutions.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: weiyongjun1@huawei.com, yuehaibing@huawei.com References: <20221025123250.143952-1-shaozhengchao@huawei.com> From: Alexander Wetzel In-Reply-To: <20221025123250.143952-1-shaozhengchao@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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-wireless@vger.kernel.org On 25.10.22 14:32, Zhengchao Shao wrote: > When device is running and the interface status is changed, the gpf issue > is triggered. The problem triggering process is as follows: > Thread A: Thread B > ieee80211_runtime_change_iftype() process_one_work() > ... ... > ieee80211_do_stop() ... > ... ... > sdata->bss = NULL ... > ... ieee80211_subif_start_xmit() > ieee80211_multicast_to_unicast > //!sdata->bss->multicast_to_unicast > cause gpf issue > > When the interface status is changed, the sending queue continues to send > packets. After the bss is set to NULL, the bss is accessed. As a result, > this causes a general-protection-fault issue. > > The following is the stack information: > general protection fault, probably for non-canonical address > 0xdffffc000000002f: 0000 [#1] PREEMPT SMP KASAN > KASAN: null-ptr-deref in range [0x0000000000000178-0x000000000000017f] > Workqueue: mld mld_ifc_work > RIP: 0010:ieee80211_subif_start_xmit+0x25b/0x1310 > Call Trace: > > dev_hard_start_xmit+0x1be/0x990 > __dev_queue_xmit+0x2c9a/0x3b60 > ip6_finish_output2+0xf92/0x1520 > ip6_finish_output+0x6af/0x11e0 > ip6_output+0x1ed/0x540 > mld_sendpack+0xa09/0xe70 > mld_ifc_work+0x71c/0xdb0 > process_one_work+0x9bf/0x1710 > worker_thread+0x665/0x1080 > kthread+0x2e4/0x3a0 > ret_from_fork+0x1f/0x30 > > > Fixes: 107395f9cf44 ("wifi: mac80211: Drop support for TX push path") Don't think this patch fixes an issue introduced with the patch you refer to. This patch changed nothing from a flow perspective and is just cleaning up unused code. It still may still make sense to refer to the series: It next to be sure triggered the issue for at least one driver (I assume it was hwsim here.) That said this seems to be more related to whatever caused this bug: f856373e2f31 ("wifi: mac80211: do not wake queues on a vif that is being stopped") > Reported-by: syzbot+c6e8fca81c294fd5620a@syzkaller.appspotmail.com > Signed-off-by: Zhengchao Shao > --- > net/mac80211/iface.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c > index dd9ac1f7d2ea..5a924459bfd1 100644 > --- a/net/mac80211/iface.c > +++ b/net/mac80211/iface.c > @@ -1900,6 +1900,9 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, > IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE); > synchronize_net(); > > + if (sdata->dev) > + netif_tx_stop_all_queues(sdata->dev); All mac80211 interfaces are now non-queuing interfaces. When you stop the netif queues for a non-queuing interface netdev will warn about that. To avoid that you have to replace the netif call with clear_bit(SDATA_STATE_RUNNING, &sdata->state); Should just work the same for you here. > + > ieee80211_do_stop(sdata, false); > > ieee80211_teardown_sdata(sdata); > @@ -1922,6 +1925,9 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, > err = ieee80211_do_open(&sdata->wdev, false); > WARN(err, "type change: do_open returned %d", err); > > + if (sdata->dev) > + netif_tx_start_all_queues(sdata->dev); That must then be of course set_bit(SDATA_STATE_RUNNING, &sdata->state); > + > ieee80211_wake_vif_queues(local, sdata, > IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE); > return ret; Alexander