Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6760991rwn; Tue, 13 Sep 2022 08:40:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR6beEtEfZHz3cIloHL7OdOvkyzoeOp3jyiWVuln6Jk85eU7Gtv8a0TCVqVx6Xb1qbOI6WyK X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr21827754edb.249.1663083619977; Tue, 13 Sep 2022 08:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663083619; cv=none; d=google.com; s=arc-20160816; b=XbOQJjGhcM+vEAgloX38JzTPEkrbYBMo4aalOJQ/fqSxH35G9X1mJ/u+VDRYk+TVvo 7Fla8s0UhDrnX24G0I9mvRtPWI4GsN3mUk/EN6Nwdx3sITSDvtl7PVMkbKZYWM/WP7gC lPdt0Lhu0kZQsb/X3xIM0yDcD9+FcT9tO/qdg9g3H/SN1Y98NDqtnj8qcd/Q3xWAC5H2 crlsTjlvCp0zbDv+Gvq7z2c+k1oWqHWM+XBAMC1PsPnwcITHnJI7uRO/EK8bstzzt4L+ QhFRIxcu+RUHrVVn+a/TvZawnolk+6FhHijk/XJ55IkcT1U5WAvcSW6BsK6MGSf95nDr Lmeg== 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=6uQmAwet7D0BgpfW7bH6c8G6Rru4D8TZWEsapFNx1eQ=; b=WsXMFPrwHbisMVKB5imdRKVTWPsGCJ63RDIGjqvLn7OSDrmXihfXgjxrpIxpDvSaKo ghNmlwLmMmBXWVf0lVZaiCJa3/sZ8kZAqsPcchPkn+jUopNT5LfyUaZHehYFU8vZU0z8 syPMh91F3FQCjse302YdmLaA2Igi5ql4+IZ9NXlTiFbQAQwgoxtNVSC6o4NiX1qRs9zK 40cakkSwd/828r7ZpcQILqYWG2P8Eixb//PMXLxdH89LGP77ASU8nDntPEB+TV4RtzJ0 Y0do5NqYaoqVy36rYJ8kngCJsYlvYZt7D5xMwH2O2TsTPm+YsssUQo9tPbToiWnoGKWN XHOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vNl1moSa; 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 l4-20020a170906794400b007801a579899si586311ejo.448.2022.09.13.08.39.53; Tue, 13 Sep 2022 08:40:19 -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=vNl1moSa; 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 S235033AbiIMPBl (ORCPT + 99 others); Tue, 13 Sep 2022 11:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235210AbiIMO7b (ORCPT ); Tue, 13 Sep 2022 10:59:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7264374B86; Tue, 13 Sep 2022 07:29:08 -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 12C4CB80FB5; Tue, 13 Sep 2022 14:28:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70733C433D6; Tue, 13 Sep 2022 14:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079305; bh=4aUWc+8xSSeE7zL6x2uFeoDypKjs1iKE72Blkd7WAXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vNl1moSaFgO2H9AfPiwjlOboAfZ6nJgoeE0XFtlplg53/UOlxxLWHk9ENCnWTPwk1 VQp2RAGOwHr2aS1eonyGphqYETia4ZNGzTkFzK6K8vpoRYlpMS7bTghhpcBQS5KhOr dc8eCKUlqiY9oF+mZY6jqMdv9ruNRjiT3id2czCQ= 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.4 056/108] wifi: mac80211: Dont finalize CSA in IBSS mode if state is disconnected Date: Tue, 13 Sep 2022 16:06:27 +0200 Message-Id: <20220913140356.035465396@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140353.549108748@linuxfoundation.org> References: <20220913140353.549108748@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 @@ -542,6 +542,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,