Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4474747rwb; Tue, 6 Sep 2022 08:03:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR6czQ7cC9aqAaYjZyvywJt6oAGSySNO/x+qJIOTK5pL/oXrYZndy/yRFWYsvCLACingId7+ X-Received: by 2002:a17:907:7f9e:b0:73c:6f39:7399 with SMTP id qk30-20020a1709077f9e00b0073c6f397399mr39653277ejc.358.1662476618873; Tue, 06 Sep 2022 08:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476618; cv=none; d=google.com; s=arc-20160816; b=qUFddXs6uph85HDrg1bujO2RFjc4Xj1c56NqjMqsRaK6ntGLMW7a7CsUxzBknSXBW9 DR5UDfyCH34pN4Q2UVcE3tsK3DneOicz4ym+fLL2nOAdPYjkTFOCaxOOUijx0hqTGnVr 6WSHCxCgOUyf2MtJ3mDg15k8288ef4MR1gCDxgyT/P4c+zBVcQ/Az3XYzCk+ZWxDt16k y2mU+Dux2Wjhq4tsQdCTdJ0Yo1SRpUZ2CeQ/z9BnkkH4GqrF3qUVbow8Zw0eBZLWAxCg uEZBD+qdeVZpQ+zvUu+B4sgbc16cBfz0bzzJp1FP1v0VeRaude9/LpQT3i+EXNzqRnWl snWA== 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=Odogwhyt84E/SFiU79wezr+un1g+/ufESZUGXoYaazs=; b=ew3ANnhi/gQS4MxKq4zrCIytGrt/f1LMCVCFCjqONETDMgJ7UAzGIyO/Che6p1CPUF C+9K1CpE6OjzDHbHgLQH/dYwpoCtd9Icahf0SozaDPePyXIK41eMaiwx+jso5rzSuIXc DJufu+I5KJPITFYFoMBzEyhpb9Wp/aWu+tPd28Y3UKTZTUZrZF1jtRJBJdr8VuhZUyE7 FShI3tWKw73X5p4Iiz4bmbRhUYLW3+jefnC9bCYIsdgIPZJvu4fWhsQIh4yKUuk3AGDx IoxpzW3o9LNqZhWxDF+HUM2wDpydbs8ck2o/xaKON2EjbMfsSI2BnS73M7dJy7JkoLrT AdbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PwsGID+s; 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 fp32-20020a1709069e2000b00741795a8603si8434078ejc.196.2022.09.06.08.03.13; Tue, 06 Sep 2022 08:03:38 -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=PwsGID+s; 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 S241958AbiIFOXp (ORCPT + 99 others); Tue, 6 Sep 2022 10:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242111AbiIFOTh (ORCPT ); Tue, 6 Sep 2022 10:19:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E611D8B2F6; Tue, 6 Sep 2022 06:50:57 -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 ams.source.kernel.org (Postfix) with ESMTPS id 44666B818E2; Tue, 6 Sep 2022 13:48:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AC02C433C1; Tue, 6 Sep 2022 13:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662472135; bh=DXU2fytwxzmrl9SUms9dI7mpnguBF0nHu9GaaMmVIYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PwsGID+sxFnC0xgpPds0hFOCCe7ToxNgBzZGT67/BWiHNR6iS9bUV0cM5SWQZ10Xr Zs2zCUTYqfhwMRJWtrYXcBVTuT8Mg5HzMlk+qmbZyz6ZWk66Hoi6TkRySSeddl52E/ +CyYBRgNkgg0jBpG4VrzrJveuPoIaS3Pkl9o1V9k= 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 5.19 139/155] wifi: mac80211: Dont finalize CSA in IBSS mode if state is disconnected Date: Tue, 6 Sep 2022 15:31:27 +0200 Message-Id: <20220906132835.336930592@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@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 @@ -534,6 +534,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,