Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6771475rwn; Tue, 13 Sep 2022 08:49:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR5xyWHw625NGRyhetb+THP3IF/Ecbx5slXhv4b9Zhw0TcQp0WKEu95xA6h7IYdWVPL0hzHc X-Received: by 2002:a17:906:4fce:b0:77f:e6c9:2745 with SMTP id i14-20020a1709064fce00b0077fe6c92745mr2803161ejw.202.1663084144682; Tue, 13 Sep 2022 08:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663084144; cv=none; d=google.com; s=arc-20160816; b=JwjSmJhapg+Azf1aUiH7+mk9/Le+HKRKmaBwa8nKVI63dh/mDhG5CBzxlgAD2nSpqF NmG83ZMqsRM2YI4HOpDXpxWu12bG+PEvDa4NUdkwR+/sqlKdO4N/RquBdjugGX2+JjQQ bNrhoPIQZFCPTDsxD+TEWNP0pjI2dLjT49N11ajjv3kQtxxHPZFEEv5Kc6hE7rOTcHB/ uJzWNr7CjBRBVIkGFf+R7sm/Re8gln2aPh5HTWvx3RsVLSsDPAaiqI2wVt4ezdZVq/sN iWywYkghwl11meU0rY30uYjGBUiy9Gi/iY2lrpFqvRQyc8Fq5ymh44lG4E92wvBPib3x WTHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eqLFQqsQWWLNSYJJcJOE85BhQ8mVZdx1kh4KNzw1s/Q=; b=vWpUBY7pYECI4C+iiM/m61UiSw5usD2acOcMuX2ngXM7rfrWL97veMqkfEtk8VL7iC 7+NQyalHOMNQfIbYXI31Sbi7BLuXCK3+r4XrPAeXKDiK1BW3o0Fki4n+AIPnC3M7qDEz 3vifmn40zVtw1JTvDAZHg4im39jnH1v+8h5Wx7zeXFCVlzehOUY1yXq2hRPbuCfeU8Yi kJF88w6qpXRkcWVf5czDC7kJGK5erhbYVKnLtllZllTXZ1CgStuILQ706PSF/6kqHm4A 3U8HwhUZZwbPRO+9BNI1q9V45KpwniQDcq6d3/PwLi0iphdLaDyBXYWokVIN0ZiLnOrY lALA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=udBCx8qs; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a170906794900b007307fa2da78si9927161ejo.450.2022.09.13.08.48.35; Tue, 13 Sep 2022 08:49:04 -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=@linuxfoundation.org header.s=korg header.b=udBCx8qs; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236013AbiIMP0a (ORCPT + 99 others); Tue, 13 Sep 2022 11:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236280AbiIMPYE (ORCPT ); Tue, 13 Sep 2022 11:24:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B06A87CA80; Tue, 13 Sep 2022 07:37:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6D259614CF; Tue, 13 Sep 2022 14:35:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CAAEC433D7; Tue, 13 Sep 2022 14:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079739; bh=exZdNZWzP0dOHve55ZJWQ3kh4qj940fegArBrUQhtkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udBCx8qsHRu66I/cDrQotrnminN7AWQ26+HlrfwKm0tZrJfN2dm6LhLWrTAsvanGV orHzk7PqDmgvH/t2aeGDqJyC9dw3T04tdk68LHKKWahmQsbwBDDUxmCIqFLFlzMGXu M2qGJsoQp3hcZsd9MKnP/Pyv4R0xxmehMsemk5y4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com, Siddh Raman Pant , Johannes Berg Subject: [PATCH 4.14 30/61] wifi: mac80211: Dont finalize CSA in IBSS mode if state is disconnected Date: Tue, 13 Sep 2022 16:07:32 +0200 Message-Id: <20220913140348.000341495@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140346.422813036@linuxfoundation.org> References: <20220913140346.422813036@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Siddh Raman Pant commit 15bc8966b6d3a5b9bfe4c9facfa02f2b69b1e5f0 upstream. When we are not connected to a channel, sending channel "switch" announcement doesn't make any sense. The BSS list is empty in that case. This causes the for loop in cfg80211_get_bss() to be bypassed, so the function returns NULL (check line 1424 of net/wireless/scan.c), causing the WARN_ON() in ieee80211_ibss_csa_beacon() to get triggered (check line 500 of net/mac80211/ibss.c), which was consequently reported on the syzkaller dashboard. Thus, check if we have an existing connection before generating the CSA beacon in ieee80211_ibss_finish_csa(). Cc: stable@vger.kernel.org Fixes: cd7760e62c2a ("mac80211: add support for CSA in IBSS mode") Link: https://syzkaller.appspot.com/bug?id=05603ef4ae8926761b678d2939a3b2ad28ab9ca6 Reported-by: syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com Signed-off-by: Siddh Raman Pant Tested-by: syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20220814151512.9985-1-code@siddh.me Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/ibss.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -544,6 +544,10 @@ int ieee80211_ibss_finish_csa(struct iee sdata_assert_lock(sdata); + /* When not connected/joined, sending CSA doesn't make sense. */ + if (ifibss->state != IEEE80211_IBSS_MLME_JOINED) + return -ENOLINK; + /* update cfg80211 bss information with the new channel */ if (!is_zero_ether_addr(ifibss->bssid)) { cbss = cfg80211_get_bss(sdata->local->hw.wiphy,